Repository navigation
[Outreachy PATCH] t0001: avoid pipes in test scripts - #2260
poojarysrujith wants to merge 1 commit into
Conversation
ec4b6a8 to
92ecaec
Compare
|
/submit |
|
Submitted as pull.2260.git.1792299301663.gitgitgadget@gmail.com To fetch this version into To fetch this version to local tag |
|
Usman Akinyemi wrote on the Git mailing list (how to reply to this email): > diff --git a/t/t0001-init.sh b/t/t0001-init.sh
> index f1d227f271..e835afee68 100755
> --- a/t/t0001-init.sh
> +++ b/t/t0001-init.sh
> @@ -678,7 +678,7 @@ 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 &&
We can put this in two lines, something like this:
git version --build-options >build-options &&
sed -ne "s/^default-ref-storage-format: //p"
build-options >expect &&
> git -C refformat rev-parse --show-ref-storage-format >actual &&
Thanks for the patch. |
|
User |
3673f8d to
7d11829
Compare
|
/submit |
|
Submitted as pull.2260.v2.git.1792666211685.gitgitgadget@gmail.com To fetch this version into To fetch this version to local tag |
|
Srujith Poojary wrote on the Git mailing list (how to reply to this email): Hi Usman,
Thanks for the suggestion! I have updated the script to split the
command into two separate lines as recommended and resolved a trailing
whitespace issue.
I've submitted v2 of the patch to the mailing list via GitGitGadget.
Best regards,
Srujith
On Thu, Oct 22, 2026 at 4:20 PM Srujith A Poojary via GitGitGadget
<gitgitgadget@gmail.com> wrote:
>
> 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>
> ---
> [Outreachy PATCH] t0001: avoid pipes in test scripts
>
> Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-2260%2Fpoojarysrujith%2Fmicroproject-init-pipe-v2
> Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-2260/poojarysrujith/microproject-init-pipe-v2
> Pull-Request: https://github.com/gitgitgadget/git/pull/2260
>
> Range-diff vs v1:
>
> 1: 92ecaec2cd ! 1: 7d118290ce [Outreachy PATCH] t0001: avoid pipes in test scripts
> @@ t/t0001-init.sh: test_expect_success 'default ref 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 &&
> ++ git version --build-options >build-options &&
> ++ sed -ne "s/^default-ref-storage-format: //p" build-options >expect &&
> git -C refformat rev-parse --show-ref-storage-format >actual &&
> test_cmp expect actual
> '
>
>
> t/t0001-init.sh | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> 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 &&
> git -C refformat rev-parse --show-ref-storage-format >actual &&
> test_cmp expect actual
> '
>
> base-commit: 6de20f6092dcf9bdb1c8efe03db4b70c82b423dd
> --
> gitgitgadget |
|
Junio C Hamano wrote on the Git mailing list (how to reply to this email): "Srujith A Poojary via GitGitGadget" <gitgitgadget@gmail.com>
writes:
> 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.
> 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.
> git -C refformat rev-parse --show-ref-storage-format >actual &&
> test_cmp expect actual
> '
>
> base-commit: 6de20f6092dcf9bdb1c8efe03db4b70c82b423dd |
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>
7d11829 to
a70ccdf
Compare
|
/preview |
|
Preview email sent as pull.2260.v3.git.1792732298112.gitgitgadget@gmail.com |
|
/submit |
|
Submitted as pull.2260.v3.git.1792732388827.gitgitgadget@gmail.com To fetch this version into To fetch this version to local tag |
|
Srujith Poojary wrote on the Git mailing list (how to reply to this email): Hi Junio,
Thanks for pointing that out! I've removed the extra indentation in v3
so the sed line aligns properly with the surrounding commands.
Best,
Srujith
On Thu, Oct 22, 2026 at 10:54 PM Junio C Hamano <gitster@pobox.com> wrote:
>
> "Srujith A Poojary via GitGitGadget" <gitgitgadget@gmail.com>
> writes:
>
> > 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.
>
> > 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.
>
> > git -C refformat rev-parse --show-ref-storage-format >actual &&
> > test_cmp expect actual
> > '
> >
> > base-commit: 6de20f6092dcf9bdb1c8efe03db4b70c82b423dd |
|
/submit |
|
Error: a70ccdf was already submitted |
|
Srujith Poojary wrote on the Git mailing list (how to reply to this email): Hi,
I have submitted v3 of the t0001 patch to the mailing list.
Just a quick note on the CI: there is a single failure in win test
(5), but it is caused by t1051-large-conversion running out of memory
during a 5GB conversion test, which is unrelated to the t0001 changes.
The patch is ready for review.
Best regards,
Srujith
On Fri, Oct 23, 2026 at 10:43 AM Srujith A Poojary via GitGitGadget
<gitgitgadget@gmail.com> wrote:
>
> 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>
> ---
> [Outreachy PATCH] t0001: avoid pipes in test scripts
>
> Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-2260%2Fpoojarysrujith%2Fmicroproject-init-pipe-v3
> Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-2260/poojarysrujith/microproject-init-pipe-v3
> Pull-Request: https://github.com/gitgitgadget/git/pull/2260
>
> Range-diff vs v2:
>
> 1: 7d118290ce ! 1: a70ccdf49e [Outreachy PATCH] t0001: avoid pipes in test scripts
> @@ t/t0001-init.sh: test_expect_success 'default ref format' '
> ) &&
> - 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 &&
> ++ sed -ne "s/^default-ref-storage-format: //p" build-options >expect &&
> git -C refformat rev-parse --show-ref-storage-format >actual &&
> test_cmp expect actual
> '
>
>
> t/t0001-init.sh | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/t/t0001-init.sh b/t/t0001-init.sh
> index f1d227f271..c8c74f681b 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 &&
> git -C refformat rev-parse --show-ref-storage-format >actual &&
> test_cmp expect actual
> '
>
> base-commit: 6de20f6092dcf9bdb1c8efe03db4b70c82b423dd
> --
> gitgitgadget |
cc: Usman Akinyemi usmanakinyemi202@gmail.com