Re: [PATCH] t9350: redirect input to only fast-import
From: Junio C Hamano <hidden>
Date: 2025-07-26 13:45:22
Christian Couder [off-list ref] writes:
quoted hunk
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 <redacted> Signed-off-by: Christian Couder <redacted> --- This addresses some leftover work discussed in: https://lore.kernel.org/git/CABPp-BHM5afgiUf7GsTPWmrf_tm6mWnvHWMKiZPxApJzN-U8gg@mail.gmail.com/ (local) 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.