* [GSoC PATCH] t2203: avoid suppressing git status exit code
[not found] <20260317185048.74421-1-jerrywang183.ref@yahoo.com>
@ 2026-03-17 18:50 ` Jialong Wang
2026-03-17 19:01 ` Junio C Hamano
0 siblings, 1 reply; 3+ messages in thread
From: Jialong Wang @ 2026-03-17 18:50 UTC (permalink / raw)
To: git; +Cc: Jialong Wang
When git status is piped into grep, the exit status of the Git
command is hidden by the pipeline. Capture the status output in a
temporary file first, and then filter it as needed, so that any
failure from git status is still noticed by the test suite.
Signed-off-by: Jialong Wang <jerrywang183@yahoo.com>
---
t/t2203-add-intent.sh | 24 ++++++++++++++++--------
1 file changed, 16 insertions(+), 8 deletions(-)
diff --git a/t/t2203-add-intent.sh b/t/t2203-add-intent.sh
index 192ad14b5f..44c1936e4d 100755
--- a/t/t2203-add-intent.sh
+++ b/t/t2203-add-intent.sh
@@ -16,7 +16,8 @@ test_expect_success 'intent to add' '
'
test_expect_success 'git status' '
- git status --porcelain | grep -v actual >actual &&
+ git status --porcelain >actual.raw &&
+ grep -v actual actual.raw >actual &&
cat >expect <<-\EOF &&
DA 1.t
A elif
@@ -26,7 +27,8 @@ test_expect_success 'git status' '
'
test_expect_success 'git status with porcelain v2' '
- git status --porcelain=v2 | grep -v "^?" >actual &&
+ git status --porcelain=v2 >actual.raw &&
+ grep -v "^?" actual.raw >actual &&
nam1=$(echo 1 | git hash-object --stdin) &&
nam2=$(git hash-object elif) &&
cat >expect <<-EOF &&
@@ -171,17 +173,20 @@ test_expect_success 'rename detection finds the right names' '
mv first third &&
git add -N third &&
- git status | grep -v "^?" >actual.1 &&
+ git status >actual.raw.1 &&
+ grep -v "^?" actual.raw.1 >actual.1 &&
test_grep "renamed: *first -> third" actual.1 &&
- git status --porcelain | grep -v "^?" >actual.2 &&
+ git status --porcelain >actual.raw.2 &&
+ grep -v "^?" actual.raw.2 >actual.2 &&
cat >expected.2 <<-\EOF &&
R first -> third
EOF
test_cmp expected.2 actual.2 &&
hash=$(git hash-object third) &&
- git status --porcelain=v2 | grep -v "^?" >actual.3 &&
+ git status --porcelain=v2 >actual.raw.3 &&
+ grep -v "^?" actual.raw.3 >actual.3 &&
cat >expected.3 <<-EOF &&
2 .R N... 100644 100644 100644 $hash $hash R100 third first
EOF
@@ -211,11 +216,13 @@ test_expect_success 'double rename detection in status' '
mv second third &&
git add -N third &&
- git status | grep -v "^?" >actual.1 &&
+ git status >actual.raw.1 &&
+ grep -v "^?" actual.raw.1 >actual.1 &&
test_grep "renamed: *first -> second" actual.1 &&
test_grep "renamed: *second -> third" actual.1 &&
- git status --porcelain | grep -v "^?" >actual.2 &&
+ git status --porcelain >actual.raw.2 &&
+ grep -v "^?" actual.raw.2 >actual.2 &&
cat >expected.2 <<-\EOF &&
R first -> second
R second -> third
@@ -223,7 +230,8 @@ test_expect_success 'double rename detection in status' '
test_cmp expected.2 actual.2 &&
hash=$(git hash-object third) &&
- git status --porcelain=v2 | grep -v "^?" >actual.3 &&
+ git status --porcelain=v2 >actual.raw.3 &&
+ grep -v "^?" actual.raw.3 >actual.3 &&
cat >expected.3 <<-EOF &&
2 R. N... 100644 100644 100644 $hash $hash R100 second first
2 .R N... 100644 100644 100644 $hash $hash R100 third second
--
2.51.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [GSoC PATCH] t2203: avoid suppressing git status exit code
2026-03-17 18:50 ` [GSoC PATCH] t2203: avoid suppressing git status exit code Jialong Wang
@ 2026-03-17 19:01 ` Junio C Hamano
0 siblings, 0 replies; 3+ messages in thread
From: Junio C Hamano @ 2026-03-17 19:01 UTC (permalink / raw)
To: Jialong Wang; +Cc: git
Jialong Wang <jerrywang183@yahoo.com> writes:
> Subject: Re: [GSoC PATCH] t2203: avoid suppressing git status exit code
We saw a patch <20260317011544.65952-1-jerrywang183@yahoo.com> that
looks similar, sent by you about 18 hours ago.
Please do *NOT* send an update without marking it as updating what
other patch it is replacing. Turning "[PATCH]" to "[PATCH v2]" is a
minimum. Explaining what changed below the three-dash line after
your sign-off would be a standard practice. Sending the updated
patch as a reply to the original would also be a good idea.
> When git status is piped into grep, the exit status of the Git
> command is hidden by the pipeline. Capture the status output in a
> temporary file first, and then filter it as needed, so that any
> failure from git status is still noticed by the test suite.
>
> Signed-off-by: Jialong Wang <jerrywang183@yahoo.com>
> ---
> t/t2203-add-intent.sh | 24 ++++++++++++++++--------
> 1 file changed, 16 insertions(+), 8 deletions(-)
>
> diff --git a/t/t2203-add-intent.sh b/t/t2203-add-intent.sh
> index 192ad14b5f..44c1936e4d 100755
> --- a/t/t2203-add-intent.sh
> +++ b/t/t2203-add-intent.sh
> @@ -16,7 +16,8 @@ test_expect_success 'intent to add' '
> '
>
> test_expect_success 'git status' '
> - git status --porcelain | grep -v actual >actual &&
> + git status --porcelain >actual.raw &&
> + grep -v actual actual.raw >actual &&
> cat >expect <<-\EOF &&
> DA 1.t
> A elif
> @@ -26,7 +27,8 @@ test_expect_success 'git status' '
> '
>
> test_expect_success 'git status with porcelain v2' '
> - git status --porcelain=v2 | grep -v "^?" >actual &&
> + git status --porcelain=v2 >actual.raw &&
> + grep -v "^?" actual.raw >actual &&
> nam1=$(echo 1 | git hash-object --stdin) &&
> nam2=$(git hash-object elif) &&
> cat >expect <<-EOF &&
> @@ -171,17 +173,20 @@ test_expect_success 'rename detection finds the right names' '
> mv first third &&
> git add -N third &&
>
> - git status | grep -v "^?" >actual.1 &&
> + git status >actual.raw.1 &&
> + grep -v "^?" actual.raw.1 >actual.1 &&
> test_grep "renamed: *first -> third" actual.1 &&
>
> - git status --porcelain | grep -v "^?" >actual.2 &&
> + git status --porcelain >actual.raw.2 &&
> + grep -v "^?" actual.raw.2 >actual.2 &&
> cat >expected.2 <<-\EOF &&
> R first -> third
> EOF
> test_cmp expected.2 actual.2 &&
>
> hash=$(git hash-object third) &&
> - git status --porcelain=v2 | grep -v "^?" >actual.3 &&
> + git status --porcelain=v2 >actual.raw.3 &&
> + grep -v "^?" actual.raw.3 >actual.3 &&
> cat >expected.3 <<-EOF &&
> 2 .R N... 100644 100644 100644 $hash $hash R100 third first
> EOF
> @@ -211,11 +216,13 @@ test_expect_success 'double rename detection in status' '
> mv second third &&
> git add -N third &&
>
> - git status | grep -v "^?" >actual.1 &&
> + git status >actual.raw.1 &&
> + grep -v "^?" actual.raw.1 >actual.1 &&
> test_grep "renamed: *first -> second" actual.1 &&
> test_grep "renamed: *second -> third" actual.1 &&
>
> - git status --porcelain | grep -v "^?" >actual.2 &&
> + git status --porcelain >actual.raw.2 &&
> + grep -v "^?" actual.raw.2 >actual.2 &&
> cat >expected.2 <<-\EOF &&
> R first -> second
> R second -> third
> @@ -223,7 +230,8 @@ test_expect_success 'double rename detection in status' '
> test_cmp expected.2 actual.2 &&
>
> hash=$(git hash-object third) &&
> - git status --porcelain=v2 | grep -v "^?" >actual.3 &&
> + git status --porcelain=v2 >actual.raw.3 &&
> + grep -v "^?" actual.raw.3 >actual.3 &&
> cat >expected.3 <<-EOF &&
> 2 R. N... 100644 100644 100644 $hash $hash R100 second first
> 2 .R N... 100644 100644 100644 $hash $hash R100 third second
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [GSoC PATCH] t2203: avoid suppressing git status exit code
[not found] ` <xmqqmse3fsvw.fsf@gitster.g>
@ 2026-03-17 19:25 ` Jialong Wang
0 siblings, 0 replies; 3+ messages in thread
From: Jialong Wang @ 2026-03-17 19:25 UTC (permalink / raw)
To: gitster; +Cc: git
Hi Junio,
Thanks, that was my mistake.
I resent it with the GSoC subject prefix, but I should have treated it
as a new version of the earlier patch, sent as [GSoC PATCH v2] in
reply to the original thread, with a short note about what changed.
I'll do that for future rerolls.
Thanks,
Jialong
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-03-17 19:25 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20260317185048.74421-1-jerrywang183.ref@yahoo.com>
2026-03-17 18:50 ` [GSoC PATCH] t2203: avoid suppressing git status exit code Jialong Wang
2026-03-17 19:01 ` Junio C Hamano
[not found] <20260317185414.65952-1-jerrywang183@yahoo.com>
[not found] ` <xmqqmse3fsvw.fsf@gitster.g>
2026-03-17 19:25 ` Jialong Wang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox