{"thread":{"id":"65360","subject":"[GSoC PATCH] t8003: avoid suppressing git's exit code","startedAt":"2026-03-26T14:11:28Z","lastAt":"2026-03-26T15:19:19Z","messageCount":2,"participants":["Trieu Huynh","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"540077","messageId":"20260326141118.146155-1-vikingtc4@gmail.com","threadId":"65360","inReplyTo":null,"subject":"[GSoC PATCH] t8003: avoid suppressing git's exit code","fromName":"Trieu Huynh","fromEmail":"vikingtc4@gmail.com","sentAt":"2026-03-26T14:11:18Z","receivedAt":"2026-03-26T14:11:28Z","isPatch":true,"body":"Update t8003-blame-corner-cases.sh to redirect git-blame output\nto a temporary file instead of piping it directly to not hide\nthe exit code of git commands behind pipes, as a crash in git\nmight go unnoticed.\n\nSigned-off-by: Trieu Huynh <vikingtc4@gmail.com>\n---\n t/t8003-blame-corner-cases.sh | 42 +++++++++++++++++++++++------------\n 1 file changed, 28 insertions(+), 14 deletions(-)\n\ndiff --git a/t/t8003-blame-corner-cases.sh b/t/t8003-blame-corner-cases.sh\nindex 731265541a..f753e26e82 100755\n--- a/t/t8003-blame-corner-cases.sh\n+++ b/t/t8003-blame-corner-cases.sh\n@@ -50,67 +50,78 @@ test_expect_success setup '\n \n test_expect_success 'straight copy without -C' '\n \n-\tgit blame uno | grep Second\n+\tgit blame uno >actual &&\n+\tgrep Second actual\n \n '\n \n test_expect_success 'straight move without -C' '\n \n-\tgit blame dos | grep Initial\n+\tgit blame dos >actual &&\n+\tgrep Initial actual\n \n '\n \n test_expect_success 'straight copy with -C' '\n \n-\tgit blame -C1 uno | grep Second\n+\tgit blame -C1 uno >actual &&\n+\tgrep Second actual\n \n '\n \n test_expect_success 'straight move with -C' '\n \n-\tgit blame -C1 dos | grep Initial\n+\tgit blame -C1 dos >actual &&\n+\tgrep Initial actual\n \n '\n \n test_expect_success 'straight copy with -C -C' '\n \n-\tgit blame -C -C1 uno | grep Initial\n+\tgit blame -C -C1 uno >actual &&\n+\tgrep Initial actual\n \n '\n \n test_expect_success 'straight move with -C -C' '\n \n-\tgit blame -C -C1 dos | grep Initial\n+\tgit blame -C -C1 dos >actual &&\n+\tgrep Initial actual\n \n '\n \n test_expect_success 'append without -C' '\n \n-\tgit blame -L2 tres | grep Second\n+\tgit blame -L2 tres >actual &&\n+\tgrep Second actual\n \n '\n \n test_expect_success 'append with -C' '\n \n-\tgit blame -L2 -C1 tres | grep Second\n+\tgit blame -L2 -C1 tres >actual &&\n+\tgrep Second actual\n \n '\n \n test_expect_success 'append with -C -C' '\n \n-\tgit blame -L2 -C -C1 tres | grep Second\n+\tgit blame -L2 -C -C1 tres >actual &&\n+\tgrep Second actual\n \n '\n \n test_expect_success 'append with -C -C -C' '\n \n-\tgit blame -L2 -C -C -C1 tres | grep Initial\n+\tgit blame -L2 -C -C -C1 tres >actual &&\n+\tgrep Initial actual\n \n '\n \n test_expect_success 'blame wholesale copy' '\n \n-\tgit blame -f -C -C1 HEAD^ -- cow | sed -e \"$pick_fc\" >current &&\n+\tgit blame -f -C -C1 HEAD^ -- cow >actual &&\n+\tsed -e \"$pick_fc\" actual >current &&\n \tcat >expected <<-\\EOF &&\n \tmouse-Initial\n \tmouse-Second\n@@ -122,7 +133,8 @@ test_expect_success 'blame wholesale copy' '\n \n test_expect_success 'blame wholesale copy and more' '\n \n-\tgit blame -f -C -C1 HEAD -- cow | sed -e \"$pick_fc\" >current &&\n+\tgit blame -f -C -C1 HEAD -- cow >actual &&\n+\tsed -e \"$pick_fc\" actual >current &&\n \tcat >expected <<-\\EOF &&\n \tmouse-Initial\n \tmouse-Second\n@@ -144,7 +156,8 @@ test_expect_success 'blame wholesale copy and more in the index' '\n \tEOF\n \tgit add horse &&\n \ttest_when_finished \"git rm -f horse\" &&\n-\tgit blame -f -C -C1 -- horse | sed -e \"$pick_fc\" >current &&\n+\tgit blame -f -C -C1 -- horse >actual &&\n+\tsed -e \"$pick_fc\" actual >current &&\n \tcat >expected <<-\\EOF &&\n \tmouse-Initial\n \tmouse-Second\n@@ -168,7 +181,8 @@ test_expect_success 'blame during cherry-pick with file rename conflict' '\n \t(git cherry-pick HEAD@{1} || test $? -eq 1) &&\n \tgit show HEAD@{1}:rodent > rodent &&\n \tgit add rodent &&\n-\tgit blame -f -C -C1 rodent | sed -e \"$pick_fc\" >current &&\n+\tgit blame -f -C -C1 rodent >actual &&\n+\tsed -e \"$pick_fc\" actual >current &&\n \tcat >expected <<-\\EOF &&\n \tmouse-Initial\n \tmouse-Second\n-- \n2.53.0.719.g41688c1a23\n\n"},{"id":"540092","messageId":"xmqq4im2sjnu.fsf@gitster.g","threadId":"65360","inReplyTo":"20260326141118.146155-1-vikingtc4@gmail.com","subject":"Re: [GSoC PATCH] t8003: avoid suppressing git's exit code","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2026-03-26T15:19:17Z","receivedAt":"2026-03-26T15:19:19Z","isPatch":true,"body":"Trieu Huynh <vikingtc4@gmail.com> writes:\n\n> Update t8003-blame-corner-cases.sh to redirect git-blame output\n> to a temporary file instead of piping it directly to not hide\n> the exit code of git commands behind pipes, as a crash in git\n> might go unnoticed.\n>\n> Signed-off-by: Trieu Huynh <vikingtc4@gmail.com>\n> ---\n>  t/t8003-blame-corner-cases.sh | 42 +++++++++++++++++++++++------------\n>  1 file changed, 28 insertions(+), 14 deletions(-)\n\nI see nothing wrong in the proposed log message nor in the patch\ntext.  Nicely done.\n\nHaving said that, we could be a little bit more ambitious and make\nthis into a two-patch series, i.e.,\n\n [1/2] does this exact change + \"grep -> test_grep\"\n [2/2] modernises the style to remove blank lines at both ends of\n       each test\n\n\n\n\n> diff --git a/t/t8003-blame-corner-cases.sh b/t/t8003-blame-corner-cases.sh\n> index 731265541a..f753e26e82 100755\n> --- a/t/t8003-blame-corner-cases.sh\n> +++ b/t/t8003-blame-corner-cases.sh\n> @@ -50,67 +50,78 @@ test_expect_success setup '\n>  \n>  test_expect_success 'straight copy without -C' '\n>  \n> -\tgit blame uno | grep Second\n> +\tgit blame uno >actual &&\n> +\tgrep Second actual\n>  \n>  '\n>  \n>  test_expect_success 'straight move without -C' '\n>  \n> -\tgit blame dos | grep Initial\n> +\tgit blame dos >actual &&\n> +\tgrep Initial actual\n>  \n>  '\n>  \n>  test_expect_success 'straight copy with -C' '\n>  \n> -\tgit blame -C1 uno | grep Second\n> +\tgit blame -C1 uno >actual &&\n> +\tgrep Second actual\n>  \n>  '\n>  \n>  test_expect_success 'straight move with -C' '\n>  \n> -\tgit blame -C1 dos | grep Initial\n> +\tgit blame -C1 dos >actual &&\n> +\tgrep Initial actual\n>  \n>  '\n>  \n>  test_expect_success 'straight copy with -C -C' '\n>  \n> -\tgit blame -C -C1 uno | grep Initial\n> +\tgit blame -C -C1 uno >actual &&\n> +\tgrep Initial actual\n>  \n>  '\n>  \n>  test_expect_success 'straight move with -C -C' '\n>  \n> -\tgit blame -C -C1 dos | grep Initial\n> +\tgit blame -C -C1 dos >actual &&\n> +\tgrep Initial actual\n>  \n>  '\n>  \n>  test_expect_success 'append without -C' '\n>  \n> -\tgit blame -L2 tres | grep Second\n> +\tgit blame -L2 tres >actual &&\n> +\tgrep Second actual\n>  \n>  '\n>  \n>  test_expect_success 'append with -C' '\n>  \n> -\tgit blame -L2 -C1 tres | grep Second\n> +\tgit blame -L2 -C1 tres >actual &&\n> +\tgrep Second actual\n>  \n>  '\n>  \n>  test_expect_success 'append with -C -C' '\n>  \n> -\tgit blame -L2 -C -C1 tres | grep Second\n> +\tgit blame -L2 -C -C1 tres >actual &&\n> +\tgrep Second actual\n>  \n >  '\n>  \n>  test_expect_success 'append with -C -C -C' '\n>  \n> -\tgit blame -L2 -C -C -C1 tres | grep Initial\n> +\tgit blame -L2 -C -C -C1 tres >actual &&\n> +\tgrep Initial actual\n>  \n>  '\n>  \n>  test_expect_success 'blame wholesale copy' '\n>  \n> -\tgit blame -f -C -C1 HEAD^ -- cow | sed -e \"$pick_fc\" >current &&\n> +\tgit blame -f -C -C1 HEAD^ -- cow >actual &&\n> +\tsed -e \"$pick_fc\" actual >current &&\n>  \tcat >expected <<-\\EOF &&\n>  \tmouse-Initial\n>  \tmouse-Second\n> @@ -122,7 +133,8 @@ test_expect_success 'blame wholesale copy' '\n>  \n>  test_expect_success 'blame wholesale copy and more' '\n>  \n> -\tgit blame -f -C -C1 HEAD -- cow | sed -e \"$pick_fc\" >current &&\n> +\tgit blame -f -C -C1 HEAD -- cow >actual &&\n> +\tsed -e \"$pick_fc\" actual >current &&\n>  \tcat >expected <<-\\EOF &&\n>  \tmouse-Initial\n>  \tmouse-Second\n> @@ -144,7 +156,8 @@ test_expect_success 'blame wholesale copy and more in the index' '\n>  \tEOF\n>  \tgit add horse &&\n>  \ttest_when_finished \"git rm -f horse\" &&\n> -\tgit blame -f -C -C1 -- horse | sed -e \"$pick_fc\" >current &&\n> +\tgit blame -f -C -C1 -- horse >actual &&\n> +\tsed -e \"$pick_fc\" actual >current &&\n>  \tcat >expected <<-\\EOF &&\n>  \tmouse-Initial\n>  \tmouse-Second\n> @@ -168,7 +181,8 @@ test_expect_success 'blame during cherry-pick with file rename conflict' '\n>  \t(git cherry-pick HEAD@{1} || test $? -eq 1) &&\n>  \tgit show HEAD@{1}:rodent > rodent &&\n>  \tgit add rodent &&\n> -\tgit blame -f -C -C1 rodent | sed -e \"$pick_fc\" >current &&\n> +\tgit blame -f -C -C1 rodent >actual &&\n> +\tsed -e \"$pick_fc\" actual >current &&\n>  \tcat >expected <<-\\EOF &&\n>  \tmouse-Initial\n>  \tmouse-Second\n"}]}