From 9b6d1fc48a29abdd49c267ce1bf06bac5151a0e4 Mon Sep 17 00:00:00 2001 From: Shubham Mishra Date: Sat, 12 Mar 2022 11:51:25 +0530 Subject: t0001-t0028: avoid pipes with Git on LHS Pipes ignore error codes of LHS command and thus we should not use them with Git in tests. As an alternative, use a 'tmp' file to write the Git output so we can test the exit code. Signed-off-by: Shubham Mishra Signed-off-by: Junio C Hamano --- t/t0000-basic.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 't/t0000-basic.sh') diff --git a/t/t0000-basic.sh b/t/t0000-basic.sh index b007f0efef..9dcbf518a7 100755 --- a/t/t0000-basic.sh +++ b/t/t0000-basic.sh @@ -1089,7 +1089,8 @@ test_expect_success 'update-index D/F conflict' ' mv path2 path0 && mv tmp path2 && git update-index --add --replace path2 path0/file2 && - numpath0=$(git ls-files path0 | wc -l) && + git ls-files path0 >tmp && + numpath0=$(wc -l path4 && git update-index --add path4 && + git ls-files -s path4 >tmp && ( - git ls-files -s path4 | - sed -e "s/ .*/ /" | + sed -e "s/ .*/ /" tmp | tr -d "\012" && echo "$a" ) | git update-index --index-info && - len=$(git ls-files "a*" | wc -c) && + git ls-files "a*" >tmp && + len=$(wc -c