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>
This commit is contained in:
Shubham Mishra
2022-03-12 11:51:25 +05:30
committed by Junio C Hamano
parent ae5d569bb2
commit 9b6d1fc48a
4 changed files with 16 additions and 14 deletions

View File

@ -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
'