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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Oct 6, 2024 at 1:33 AM Usman Akinyemi via GitGitGadget
<gitgitgadget@xxxxxxxxx> 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...

> Signed-off-by: Usman Akinyemi <usmanakinyemi202@xxxxxxxxx>
> ---
> 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 &&
    ...





[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux