diff options
author | Shubham Mishra <shivam828787@gmail.com> | 2022-03-12 09:21:25 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-03-13 03:22:01 +0300 |
commit | 9b6d1fc48a29abdd49c267ce1bf06bac5151a0e4 (patch) | |
tree | 3d9b60799bcb86c478241e7330414c0db2012800 /t/t0000-basic.sh | |
parent | ae5d569bb22ea4e889c9a2da757ed0c253ec1fc1 (diff) |
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 <shivam828787@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t0000-basic.sh')
-rwxr-xr-x | t/t0000-basic.sh | 10 |
1 files changed, 6 insertions, 4 deletions
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 <tmp) && test $numpath0 = 1 ' @@ -1103,13 +1104,14 @@ test_expect_success 'very long name in the index handled sanely' ' >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 <tmp) && test $len = 4098 ' |