Re: [PATCH v2] [Outreachy PATCH] t0001: avoid pipes in test scripts
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Oct 22, 2026, 17:24 UTC
- Message-ID
- <xmqqbj8lhcng.fsf@gitster.g>
- In-Reply-To
- <pull.2260.v2.git.1792666211685.gitgitgadget@gmail.com>
"Srujith A Poojary via GitGitGadget" <gitgitgadget@gmail.com> writes:
Show 8 quoted lines
> From: Srujith Poojary <poojarysrujith@gmail.com> > > Avoid piping output from git version directly into sed to ensure > > that any command failure is properly caught by test scripts. > > Signed-off-by: Srujith Poojary <poojarysrujith@gmail.com> > ---
You do not want a blank line in the middle of a sentence.
Show 11 quoted lines
> diff --git a/t/t0001-init.sh b/t/t0001-init.sh > index f1d227f271..02217a9bf8 100755 > --- a/t/t0001-init.sh > +++ b/t/t0001-init.sh > @@ -678,7 +678,8 @@ test_expect_success 'default ref format' ' > sane_unset GIT_DEFAULT_REF_STORAGE_FORMAT && > git init refformat > ) && > - git version --build-options | sed -ne "s/^default-ref-storage-format: //p" >expect && > + git version --build-options >build-options && > + sed -ne "s/^default-ref-storage-format: //p" build-options >expect &&
Unnecessary indentation. The only reason why you thought it was needed was because the original was (wrongly) expressed as a single pipeline. Once that glitch is gone, anybody reading the resulting code has no reason to think that this "sed" is associated stronger to the previous "git version" than with the next "git rev-parse" line.
Show 5 quoted lines
> git -C refformat rev-parse --show-ref-storage-format >actual && > test_cmp expect actual > ' > > base-commit: 6de20f6092dcf9bdb1c8efe03db4b70c82b423dd