{"thread":{"id":"65281","subject":"[GSoC PATCH] t2203: avoid suppressing git status exit code","startedAt":"2026-03-17T18:51:00Z","lastAt":"2026-03-17T19:01:21Z","messageCount":2,"participants":["Jialong Wang","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"539250","messageId":"20260317185048.74421-1-jerrywang183@yahoo.com","threadId":"65281","inReplyTo":"20260317185048.74421-1-jerrywang183.ref@yahoo.com","subject":"[GSoC PATCH] t2203: avoid suppressing git status exit code","fromName":"Jialong Wang","fromEmail":"jerrywang183@yahoo.com","sentAt":"2026-03-17T18:50:36Z","receivedAt":"2026-03-17T18:51:00Z","isPatch":true,"sender":{"key":"jerrywang183@yahoo.com","avatar":null},"body":"When git status is piped into grep, the exit status of the Git\ncommand is hidden by the pipeline. Capture the status output in a\ntemporary file first, and then filter it as needed, so that any\nfailure from git status is still noticed by the test suite.\n\nSigned-off-by: Jialong Wang <jerrywang183@yahoo.com>\n---\n t/t2203-add-intent.sh | 24 ++++++++++++++++--------\n 1 file changed, 16 insertions(+), 8 deletions(-)\n\ndiff --git a/t/t2203-add-intent.sh b/t/t2203-add-intent.sh\nindex 192ad14b5f..44c1936e4d 100755\n--- a/t/t2203-add-intent.sh\n+++ b/t/t2203-add-intent.sh\n@@ -16,7 +16,8 @@ test_expect_success 'intent to add' '\n '\n \n test_expect_success 'git status' '\n-\tgit status --porcelain | grep -v actual >actual &&\n+\tgit status --porcelain >actual.raw &&\n+\tgrep -v actual actual.raw >actual &&\n \tcat >expect <<-\\EOF &&\n \tDA 1.t\n \tA  elif\n@@ -26,7 +27,8 @@ test_expect_success 'git status' '\n '\n \n test_expect_success 'git status with porcelain v2' '\n-\tgit status --porcelain=v2 | grep -v \"^?\" >actual &&\n+\tgit status --porcelain=v2 >actual.raw &&\n+\tgrep -v \"^?\" actual.raw >actual &&\n \tnam1=$(echo 1 | git hash-object --stdin) &&\n \tnam2=$(git hash-object elif) &&\n \tcat >expect <<-EOF &&\n@@ -171,17 +173,20 @@ test_expect_success 'rename detection finds the right names' '\n \t\tmv first third &&\n \t\tgit add -N third &&\n \n-\t\tgit status | grep -v \"^?\" >actual.1 &&\n+\t\tgit status >actual.raw.1 &&\n+\t\tgrep -v \"^?\" actual.raw.1 >actual.1 &&\n \t\ttest_grep \"renamed: *first -> third\" actual.1 &&\n \n-\t\tgit status --porcelain | grep -v \"^?\" >actual.2 &&\n+\t\tgit status --porcelain >actual.raw.2 &&\n+\t\tgrep -v \"^?\" actual.raw.2 >actual.2 &&\n \t\tcat >expected.2 <<-\\EOF &&\n \t\t R first -> third\n \t\tEOF\n \t\ttest_cmp expected.2 actual.2 &&\n \n \t\thash=$(git hash-object third) &&\n-\t\tgit status --porcelain=v2 | grep -v \"^?\" >actual.3 &&\n+\t\tgit status --porcelain=v2 >actual.raw.3 &&\n+\t\tgrep -v \"^?\" actual.raw.3 >actual.3 &&\n \t\tcat >expected.3 <<-EOF &&\n \t\t2 .R N... 100644 100644 100644 $hash $hash R100 third\tfirst\n \t\tEOF\n@@ -211,11 +216,13 @@ test_expect_success 'double rename detection in status' '\n \t\tmv second third &&\n \t\tgit add -N third &&\n \n-\t\tgit status | grep -v \"^?\" >actual.1 &&\n+\t\tgit status >actual.raw.1 &&\n+\t\tgrep -v \"^?\" actual.raw.1 >actual.1 &&\n \t\ttest_grep \"renamed: *first -> second\" actual.1 &&\n \t\ttest_grep \"renamed: *second -> third\" actual.1 &&\n \n-\t\tgit status --porcelain | grep -v \"^?\" >actual.2 &&\n+\t\tgit status --porcelain >actual.raw.2 &&\n+\t\tgrep -v \"^?\" actual.raw.2 >actual.2 &&\n \t\tcat >expected.2 <<-\\EOF &&\n \t\tR  first -> second\n \t\t R second -> third\n@@ -223,7 +230,8 @@ test_expect_success 'double rename detection in status' '\n \t\ttest_cmp expected.2 actual.2 &&\n \n \t\thash=$(git hash-object third) &&\n-\t\tgit status --porcelain=v2 | grep -v \"^?\" >actual.3 &&\n+\t\tgit status --porcelain=v2 >actual.raw.3 &&\n+\t\tgrep -v \"^?\" actual.raw.3 >actual.3 &&\n \t\tcat >expected.3 <<-EOF &&\n \t\t2 R. N... 100644 100644 100644 $hash $hash R100 second\tfirst\n \t\t2 .R N... 100644 100644 100644 $hash $hash R100 third\tsecond\n-- \n2.51.0\n\n"},{"id":"539252","messageId":"xmqq7bral1q9.fsf@gitster.g","threadId":"65281","inReplyTo":"20260317185048.74421-1-jerrywang183@yahoo.com","subject":"Re: [GSoC PATCH] t2203: avoid suppressing git status exit code","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2026-03-17T19:01:18Z","receivedAt":"2026-03-17T19:01:21Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jialong Wang <jerrywang183@yahoo.com> writes:\n\n> Subject: Re: [GSoC PATCH] t2203: avoid suppressing git status exit code\n\nWe saw a patch <20260317011544.65952-1-jerrywang183@yahoo.com> that\nlooks similar, sent by you about 18 hours ago.\n\nPlease do *NOT* send an update without marking it as updating what\nother patch it is replacing.  Turning \"[PATCH]\" to \"[PATCH v2]\" is a\nminimum.  Explaining what changed below the three-dash line after\nyour sign-off would be a standard practice.  Sending the updated\npatch as a reply to the original would also be a good idea.\n\n> When git status is piped into grep, the exit status of the Git\n> command is hidden by the pipeline. Capture the status output in a\n> temporary file first, and then filter it as needed, so that any\n> failure from git status is still noticed by the test suite.\n>\n> Signed-off-by: Jialong Wang <jerrywang183@yahoo.com>\n> ---\n>  t/t2203-add-intent.sh | 24 ++++++++++++++++--------\n>  1 file changed, 16 insertions(+), 8 deletions(-)\n>\n> diff --git a/t/t2203-add-intent.sh b/t/t2203-add-intent.sh\n> index 192ad14b5f..44c1936e4d 100755\n> --- a/t/t2203-add-intent.sh\n> +++ b/t/t2203-add-intent.sh\n> @@ -16,7 +16,8 @@ test_expect_success 'intent to add' '\n>  '\n>  \n>  test_expect_success 'git status' '\n> -\tgit status --porcelain | grep -v actual >actual &&\n> +\tgit status --porcelain >actual.raw &&\n> +\tgrep -v actual actual.raw >actual &&\n>  \tcat >expect <<-\\EOF &&\n>  \tDA 1.t\n>  \tA  elif\n> @@ -26,7 +27,8 @@ test_expect_success 'git status' '\n>  '\n>  \n>  test_expect_success 'git status with porcelain v2' '\n> -\tgit status --porcelain=v2 | grep -v \"^?\" >actual &&\n> +\tgit status --porcelain=v2 >actual.raw &&\n> +\tgrep -v \"^?\" actual.raw >actual &&\n>  \tnam1=$(echo 1 | git hash-object --stdin) &&\n>  \tnam2=$(git hash-object elif) &&\n>  \tcat >expect <<-EOF &&\n> @@ -171,17 +173,20 @@ test_expect_success 'rename detection finds the right names' '\n>  \t\tmv first third &&\n>  \t\tgit add -N third &&\n>  \n> -\t\tgit status | grep -v \"^?\" >actual.1 &&\n> +\t\tgit status >actual.raw.1 &&\n> +\t\tgrep -v \"^?\" actual.raw.1 >actual.1 &&\n>  \t\ttest_grep \"renamed: *first -> third\" actual.1 &&\n>  \n> -\t\tgit status --porcelain | grep -v \"^?\" >actual.2 &&\n> +\t\tgit status --porcelain >actual.raw.2 &&\n> +\t\tgrep -v \"^?\" actual.raw.2 >actual.2 &&\n>  \t\tcat >expected.2 <<-\\EOF &&\n>  \t\t R first -> third\n>  \t\tEOF\n>  \t\ttest_cmp expected.2 actual.2 &&\n>  \n>  \t\thash=$(git hash-object third) &&\n> -\t\tgit status --porcelain=v2 | grep -v \"^?\" >actual.3 &&\n> +\t\tgit status --porcelain=v2 >actual.raw.3 &&\n> +\t\tgrep -v \"^?\" actual.raw.3 >actual.3 &&\n>  \t\tcat >expected.3 <<-EOF &&\n>  \t\t2 .R N... 100644 100644 100644 $hash $hash R100 third\tfirst\n>  \t\tEOF\n> @@ -211,11 +216,13 @@ test_expect_success 'double rename detection in status' '\n>  \t\tmv second third &&\n>  \t\tgit add -N third &&\n>  \n> -\t\tgit status | grep -v \"^?\" >actual.1 &&\n> +\t\tgit status >actual.raw.1 &&\n> +\t\tgrep -v \"^?\" actual.raw.1 >actual.1 &&\n>  \t\ttest_grep \"renamed: *first -> second\" actual.1 &&\n>  \t\ttest_grep \"renamed: *second -> third\" actual.1 &&\n>  \n> -\t\tgit status --porcelain | grep -v \"^?\" >actual.2 &&\n> +\t\tgit status --porcelain >actual.raw.2 &&\n> +\t\tgrep -v \"^?\" actual.raw.2 >actual.2 &&\n>  \t\tcat >expected.2 <<-\\EOF &&\n>  \t\tR  first -> second\n>  \t\t R second -> third\n> @@ -223,7 +230,8 @@ test_expect_success 'double rename detection in status' '\n>  \t\ttest_cmp expected.2 actual.2 &&\n>  \n>  \t\thash=$(git hash-object third) &&\n> -\t\tgit status --porcelain=v2 | grep -v \"^?\" >actual.3 &&\n> +\t\tgit status --porcelain=v2 >actual.raw.3 &&\n> +\t\tgrep -v \"^?\" actual.raw.3 >actual.3 &&\n>  \t\tcat >expected.3 <<-EOF &&\n>  \t\t2 R. N... 100644 100644 100644 $hash $hash R100 second\tfirst\n>  \t\t2 .R N... 100644 100644 100644 $hash $hash R100 third\tsecond\n"}]}