Subject: Re: [PATCH] t9350: redirect input to only fast-import

From: Junio C Hamano <[email-masked]>
Date: Sat, 26 Jul 2025 06:45:18 -0700

Christian Couder <[email-masked]> writes:

> A number of tests in "t9350-fast-export.sh" are using sub-shells to
> redirect content to a number of commands instead of only
> `git fast-import`.
>
> This is confusing and possibly error-prone, so let's change those tests
> so that no sub-shell is used and the content goes only to
> `git fast-import`.
>
> Reported-by: Elijah Newren <[email-masked]>
> Signed-off-by: Christian Couder <[email-masked]>
> ---
>
> This addresses some leftover work discussed in:
>
> https://lore.kernel.org/git/[email-masked]/
>
>
> t/t9350-fast-export.sh | 215 +++++++++++++++++------------------------
>  1 file changed, 91 insertions(+), 124 deletions(-)
>
> diff --git a/t/t9350-fast-export.sh b/t/t9350-fast-export.sh
> index 46700dbc40..8f85c69d62 100755
> --- a/t/t9350-fast-export.sh
> +++ b/t/t9350-fast-export.sh
> @@ -48,12 +48,11 @@ test_expect_success 'fast-export | fast-import' '
>  	mkdir new &&
>  	git --git-dir=new/.git init &&
>  	git fast-export --all >actual &&
> -	(cd new &&
> -	 git fast-import &&
> -	 test $MAIN = $(git rev-parse --verify refs/heads/main) &&
> -	 test $REIN = $(git rev-parse --verify refs/tags/rein) &&
> -	 test $WER = $(git rev-parse --verify refs/heads/wer) &&
> -	 test $MUSS = $(git rev-parse --verify refs/tags/muss)) <actual
> +	git -C new fast-import <actual &&
> +	test $MAIN = $(git -C new rev-parse --verify refs/heads/main) &&
> +	test $REIN = $(git -C new rev-parse --verify refs/tags/rein) &&
> +	test $WER = $(git -C new rev-parse --verify refs/heads/wer) &&
> +	test $MUSS = $(git -C new rev-parse --verify refs/tags/muss)

That's a great simplification, especially with the use of "git -C
<there>" construct to move there just for that single command.  Very
nice.