Thread (63 messages) 63 messages, 7 authors, 2024-10-07

Re: [PATCH 1/2] [Outreachy][Patch v1] t3404: avoid losing exit status to pipes

From: Eric Sunshine <hidden>
Date: 2024-10-06 05:55:19

On Sun, Oct 6, 2024 at 1:33 AM Usman Akinyemi via GitGitGadget
[off-list ref] wrote:
The exit code of the preceding command in a pipe is disregarded. So
if that preceding command is a Git command that fails, the test would
not fail. Instead, by saving the output of that Git command to a file,
and removing the pipe, we make sure the test will fail if that Git
command fails.
Okay, makes sense.

One minor style comment below...
quoted hunk ↗ jump to hunk
Signed-off-by: Usman Akinyemi <redacted>
---
diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh
@@ -470,10 +481,10 @@ test_expect_success 'squash and fixup generate correct log messages' '
-       git cat-file commit HEAD@{2} |
-               grep "^# This is a combination of 3 commits\."  &&
-       git cat-file commit HEAD@{3} |
-               grep "^# This is a combination of 2 commits\."  &&
+       git cat-file commit HEAD@{2} >actual &&
+               grep "^# This is a combination of 3 commits\." actual &&
+       git cat-file commit HEAD@{3} >actual &&
+               grep "^# This is a combination of 2 commits\." actual  &&
We wouldn't normally indent the `grep` line like this. Now that you've
dropped the patch, it would be best to lose the extra indentation, as
well:

    git cat-file commit HEAD@{2} >actual &&
    grep "^# This is a combination of 3 commits\." actual &&
    ...
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help