t4129: prevent loss of exit code due to the use of pipes
Piping the output of git commands like git-ls-files to another command (grep in this case) hides the exit code returned by these commands. Prevent this by storing the output of git-ls-files to a temporary file and then "grep-ping" from that file. Replace grep with test_grep as the latter is more verbose when it fails. Signed-off-by: Chandra Pratap <chandrapratap3519@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>maint
parent
a54a84b333
commit
1260914190
|
@ -41,7 +41,8 @@ test_expect_success FILEMODE 'same mode (index only)' '
|
||||||
chmod +x file &&
|
chmod +x file &&
|
||||||
git add file &&
|
git add file &&
|
||||||
git apply --cached patch-0.txt &&
|
git apply --cached patch-0.txt &&
|
||||||
git ls-files -s file | grep "^100755"
|
git ls-files -s file >ls-files-output &&
|
||||||
|
test_grep "^100755" ls-files-output
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success FILEMODE 'mode update (no index)' '
|
test_expect_success FILEMODE 'mode update (no index)' '
|
||||||
|
@ -60,7 +61,8 @@ test_expect_success FILEMODE 'mode update (with index)' '
|
||||||
test_expect_success FILEMODE 'mode update (index only)' '
|
test_expect_success FILEMODE 'mode update (index only)' '
|
||||||
git reset --hard &&
|
git reset --hard &&
|
||||||
git apply --cached patch-1.txt &&
|
git apply --cached patch-1.txt &&
|
||||||
git ls-files -s file | grep "^100755"
|
git ls-files -s file >ls-files-output &&
|
||||||
|
test_grep "^100755" ls-files-output
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success FILEMODE 'empty mode is rejected' '
|
test_expect_success FILEMODE 'empty mode is rejected' '
|
||||||
|
|
Loading…
Reference in New Issue