public inbox for git@vger.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Trieu Huynh <vikingtc4@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [GSoC PATCH] t8003: avoid suppressing git's exit code
Date: Thu, 26 Mar 2026 08:19:17 -0700	[thread overview]
Message-ID: <xmqq4im2sjnu.fsf@gitster.g> (raw)
In-Reply-To: <20260326141118.146155-1-vikingtc4@gmail.com> (Trieu Huynh's message of "Thu, 26 Mar 2026 23:11:18 +0900")

Trieu Huynh <vikingtc4@gmail.com> writes:

> Update t8003-blame-corner-cases.sh to redirect git-blame output
> to a temporary file instead of piping it directly to not hide
> the exit code of git commands behind pipes, as a crash in git
> might go unnoticed.
>
> Signed-off-by: Trieu Huynh <vikingtc4@gmail.com>
> ---
>  t/t8003-blame-corner-cases.sh | 42 +++++++++++++++++++++++------------
>  1 file changed, 28 insertions(+), 14 deletions(-)

I see nothing wrong in the proposed log message nor in the patch
text.  Nicely done.

Having said that, we could be a little bit more ambitious and make
this into a two-patch series, i.e.,

 [1/2] does this exact change + "grep -> test_grep"
 [2/2] modernises the style to remove blank lines at both ends of
       each test




> diff --git a/t/t8003-blame-corner-cases.sh b/t/t8003-blame-corner-cases.sh
> index 731265541a..f753e26e82 100755
> --- a/t/t8003-blame-corner-cases.sh
> +++ b/t/t8003-blame-corner-cases.sh
> @@ -50,67 +50,78 @@ test_expect_success setup '
>  
>  test_expect_success 'straight copy without -C' '
>  
> -	git blame uno | grep Second
> +	git blame uno >actual &&
> +	grep Second actual
>  
>  '
>  
>  test_expect_success 'straight move without -C' '
>  
> -	git blame dos | grep Initial
> +	git blame dos >actual &&
> +	grep Initial actual
>  
>  '
>  
>  test_expect_success 'straight copy with -C' '
>  
> -	git blame -C1 uno | grep Second
> +	git blame -C1 uno >actual &&
> +	grep Second actual
>  
>  '
>  
>  test_expect_success 'straight move with -C' '
>  
> -	git blame -C1 dos | grep Initial
> +	git blame -C1 dos >actual &&
> +	grep Initial actual
>  
>  '
>  
>  test_expect_success 'straight copy with -C -C' '
>  
> -	git blame -C -C1 uno | grep Initial
> +	git blame -C -C1 uno >actual &&
> +	grep Initial actual
>  
>  '
>  
>  test_expect_success 'straight move with -C -C' '
>  
> -	git blame -C -C1 dos | grep Initial
> +	git blame -C -C1 dos >actual &&
> +	grep Initial actual
>  
>  '
>  
>  test_expect_success 'append without -C' '
>  
> -	git blame -L2 tres | grep Second
> +	git blame -L2 tres >actual &&
> +	grep Second actual
>  
>  '
>  
>  test_expect_success 'append with -C' '
>  
> -	git blame -L2 -C1 tres | grep Second
> +	git blame -L2 -C1 tres >actual &&
> +	grep Second actual
>  
>  '
>  
>  test_expect_success 'append with -C -C' '
>  
> -	git blame -L2 -C -C1 tres | grep Second
> +	git blame -L2 -C -C1 tres >actual &&
> +	grep Second actual
>  
 >  '
>  
>  test_expect_success 'append with -C -C -C' '
>  
> -	git blame -L2 -C -C -C1 tres | grep Initial
> +	git blame -L2 -C -C -C1 tres >actual &&
> +	grep Initial actual
>  
>  '
>  
>  test_expect_success 'blame wholesale copy' '
>  
> -	git blame -f -C -C1 HEAD^ -- cow | sed -e "$pick_fc" >current &&
> +	git blame -f -C -C1 HEAD^ -- cow >actual &&
> +	sed -e "$pick_fc" actual >current &&
>  	cat >expected <<-\EOF &&
>  	mouse-Initial
>  	mouse-Second
> @@ -122,7 +133,8 @@ test_expect_success 'blame wholesale copy' '
>  
>  test_expect_success 'blame wholesale copy and more' '
>  
> -	git blame -f -C -C1 HEAD -- cow | sed -e "$pick_fc" >current &&
> +	git blame -f -C -C1 HEAD -- cow >actual &&
> +	sed -e "$pick_fc" actual >current &&
>  	cat >expected <<-\EOF &&
>  	mouse-Initial
>  	mouse-Second
> @@ -144,7 +156,8 @@ test_expect_success 'blame wholesale copy and more in the index' '
>  	EOF
>  	git add horse &&
>  	test_when_finished "git rm -f horse" &&
> -	git blame -f -C -C1 -- horse | sed -e "$pick_fc" >current &&
> +	git blame -f -C -C1 -- horse >actual &&
> +	sed -e "$pick_fc" actual >current &&
>  	cat >expected <<-\EOF &&
>  	mouse-Initial
>  	mouse-Second
> @@ -168,7 +181,8 @@ test_expect_success 'blame during cherry-pick with file rename conflict' '
>  	(git cherry-pick HEAD@{1} || test $? -eq 1) &&
>  	git show HEAD@{1}:rodent > rodent &&
>  	git add rodent &&
> -	git blame -f -C -C1 rodent | sed -e "$pick_fc" >current &&
> +	git blame -f -C -C1 rodent >actual &&
> +	sed -e "$pick_fc" actual >current &&
>  	cat >expected <<-\EOF &&
>  	mouse-Initial
>  	mouse-Second

      reply	other threads:[~2026-03-26 15:19 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-26 14:11 [GSoC PATCH] t8003: avoid suppressing git's exit code Trieu Huynh
2026-03-26 15:19 ` Junio C Hamano [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqq4im2sjnu.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=vikingtc4@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox