t0001: avoid pipes in test scripts
PATCH 1/1 t0001: avoid pipes in test scripts
From: Srujith Poojary <[email protected]>
Avoid piping output from git version directly into sed to ensure
that any command failure is properly caught by test scripts.
---
[Outreachy PATCH] t0001: avoid pipes in test scripts
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-2260%2Fpoojarysrujith%2Fmicroproject-init-pipe-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-2260/poojarysrujith/microproject-init-pipe-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/2260
t/t0001-init.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
t/t0001-init.sh +1 -1
@@ -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 && git -C refformat rev-parse --show-ref-storage-format >actual && test_cmp expect actual '
base-commit: 6de20f6092dcf9bdb1c8efe03db4b70c82b423dd
Signature · 1 line
gitgitgadget
t/t0001-init.sh test_expect_success 'default ref format' ' · line 681
Quoted 10 lines
t/t0001-init.sh +1
-1@@ -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 &&
t/t0001-init.sh test_expect_success 'default ref format' ' · line 682
Quoted 1 line
t/t0001-init.sh +0
-0git -C refformat rev-parse --show-ref-storage-format >actual &&
Thanks for the patch.
PATCH v2 1/1 t0001: avoid pipes in test scripts
In reply to Srujith A Poojary via GitGitGadgetFrom: Srujith Poojary <[email protected]>
Avoid piping output from git version directly into sed to ensure
that any command failure is properly caught by test scripts.
---
[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(-)
t/t0001-init.sh +2 -1
@@ -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
Signature · 1 line
gitgitgadget
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
Quoted 51 lines · Srujith A Poojary via GitGitGadget
From: Srujith Poojary <[email protected]>
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 <[email protected]>---
[Outreachy PATCH] t0001: avoid pipes in test scriptsPublished-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/2260Range-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(-)t/t0001-init.sh +2
-1@@ -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
"Srujith A Poojary via GitGitGadget" <[email protected]>
Quoted 8 lines · writes:
From: Srujith Poojary <[email protected]>
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 <[email protected]>---
You do not want a blank line in the middle of a sentence.
t/t0001-init.sh test_expect_success 'default ref format' ' · line 682
Quoted 11 lines
t/t0001-init.sh +2
-1@@ -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.
Quoted 5 lines
t/t0001-init.sh +0
-0git -C refformat rev-parse --show-ref-storage-format >actual && test_cmp expect actual 'base-commit:
6de20f6092dcf9bdb1c8efe03db4b70c82b423dd
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
Quoted 39 lines · Junio C Hamano
"Srujith A Poojary via GitGitGadget" <[email protected]>
Quoted 8 lines · writes:
From: Srujith Poojary <[email protected]>
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 <[email protected]>---
You do not want a blank line in the middle of a sentence.
t/t0001-init.sh test_expect_success 'default ref format' ' · line 682
Quoted 11 lines
t/t0001-init.sh +2
-1@@ -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.
Quoted 5 lines
t/t0001-init.sh +0
-0git -C refformat rev-parse --show-ref-storage-format >actual && test_cmp expect actual 'base-commit:
6de20f6092dcf9bdb1c8efe03db4b70c82b423dd
PATCH v3 1/1 t0001: avoid pipes in test scripts
In reply to Srujith A Poojary via GitGitGadgetFrom: Srujith Poojary <[email protected]>
Avoid piping output from git version directly into sed to ensure
that any command failure is properly caught by test scripts.
---
[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(-)
t/t0001-init.sh +2 -1
@@ -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
Signature · 1 line
gitgitgadget
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
Quoted 50 lines · Srujith A Poojary via GitGitGadget
From: Srujith Poojary <[email protected]>
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 <[email protected]>---
[Outreachy PATCH] t0001: avoid pipes in test scriptsPublished-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/2260Range-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(-)t/t0001-init.sh +2
-1@@ -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
Quoted 5 lines · Srujith A Poojary via GitGitGadget
From: Srujith Poojary <[email protected]>
Avoid piping output from git version directly into sed to ensure
that any command failure is properly caught by test scripts.
Formatting of your commit message is off a bit with an empty line in the middle of the sentence.
Quoted 5 lines
t/t0001-init.sh +0
-0
t/t0001-init.sh test_expect_success 'default ref format' ' · line 685
Quoted 9 lines
t/t0001-init.sh +2
-1@@ -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 '
The changes look good to me though. Thanks!
Patrick
Quoted 28 lines · Patrick Steinhardt
Quoted 5 lines · Srujith A Poojary via GitGitGadget
From: Srujith Poojary <[email protected]>
Avoid piping output from git version directly into sed to ensure
that any command failure is properly caught by test scripts.
Formatting of your commit message is off a bit with an empty line in the middle of the sentence.
Quoted 5 lines
t/t0001-init.sh +0
-0t/t0001-init.sh test_expect_success 'default ref format' ' · line 685
Quoted 9 lines
t/t0001-init.sh +2
-1@@ -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 'The changes look good to me though. Thanks!
Quoted 1 line
Patrick
Hi Patrick,
Thank you for reviewing! Good catch—I've removed the empty line in the commit message and submitted the updated version.
Best regards,
Srujith
PATCH v4 1/1 t0001: avoid pipes in test scripts
In reply to Srujith A Poojary via GitGitGadgetFrom: Srujith Poojary <[email protected]>
Avoid piping output from git version directly into sed to ensure that any command failure is properly caught by test scripts.
---
[Outreachy PATCH] t0001: avoid pipes in test scripts
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-2260%2Fpoojarysrujith%2Fmicroproject-init-pipe-v4
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-2260/poojarysrujith/microproject-init-pipe-v4
Pull-Request: https://github.com/gitgitgadget/git/pull/2260
Range-diff vs v3:
1: a70ccdf49e ! 1: 4373eef413 [Outreachy PATCH] t0001: avoid pipes in test scripts
@@ Commit message
[Outreachy PATCH] t0001: avoid pipes in test scripts
Avoid piping output from git version directly into sed to ensure
-
that any command failure is properly caught by test scripts.
t/t0001-init.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
t/t0001-init.sh +2 -1
@@ -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
Signature · 1 line
gitgitgadget
Quoted 11 lines · Srujith A Poojary via GitGitGadget
Range-diff vs v3:
1:
a70ccdf49e! 1:4373eef413[Outreachy PATCH] t0001: avoid pipes in test scripts
@@ Commit message
[Outreachy PATCH] t0001: avoid pipes in test scriptsAvoid 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 <[email protected]>
Thanks, this version looks good to me.
Patrick
Quoted 12 lines · Patrick Steinhardt
Quoted 10 lines · Srujith A Poojary via GitGitGadget
Range-diff vs v3:
1:
a70ccdf49e! 1:4373eef413[Outreachy PATCH] t0001: avoid pipes in test scripts
@@ Commit message
[Outreachy PATCH] t0001: avoid pipes in test scriptsAvoid piping output from git version directly into sed to ensure
-
that any command failure is properly caught by test scripts.
Quoted 5 lines
Quoted 1 line
Signed-off-by Srujith Poojary <[email protected]>Thanks, this version looks good to me.
Patrick
Hi Patrick,
Thank you for the review and guidance throughout this patch!
Best regards,
Srujith