Skip to content

Commit 87e8fb1

Browse files
pks-tgitster
authored andcommitted
t: prepare test_match_signal () calls for set -e
We have a couple of calls to `test_match_signal ()` where we execute a Git command and expect it to die with a specific signal. These calls will essentially execute the process in a subshell via `foo; echo $?`, but as we expect `foo` to fail this will cause the overall subshell to fail once we `set -e`. Fix this issue by using `foo && echo 0 || echo $?` instead. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 8c9303b commit 87e8fb1

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

t/t0005-signals.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,12 @@ test_expect_success 'create blob' '
4242
'
4343

4444
test_expect_success !MINGW 'a constipated git dies with SIGPIPE' '
45-
OUT=$( ((large_git; echo $? 1>&3) | :) 3>&1 ) &&
45+
OUT=$( ((large_git && echo 0 1>&3 || echo $? 1>&3) | :) 3>&1 ) &&
4646
test_match_signal 13 "$OUT"
4747
'
4848

4949
test_expect_success !MINGW 'a constipated git dies with SIGPIPE even if parent ignores it' '
50-
OUT=$( ((trap "" PIPE && large_git; echo $? 1>&3) | :) 3>&1 ) &&
50+
OUT=$( ((trap "" PIPE && large_git && echo 0 1>&3 || echo $? 1>&3) | :) 3>&1 ) &&
5151
test_match_signal 13 "$OUT"
5252
'
5353

t/t3600-rm.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ test_expect_success 'choking "git rm" should not let it die with cruft (induce S
260260

261261
test_expect_success !MINGW 'choking "git rm" should not let it die with cruft (induce and check SIGPIPE)' '
262262
choke_git_rm_setup &&
263-
OUT=$( ((trap "" PIPE && git rm -n "some-file-*"; echo $? 1>&3) | :) 3>&1 ) &&
263+
OUT=$( ((trap "" PIPE && git rm -n "some-file-*" && echo 0 1>&3 || echo $? 1>&3) | :) 3>&1 ) &&
264264
test_match_signal 13 "$OUT" &&
265265
test_path_is_missing .git/index.lock
266266
'

0 commit comments

Comments
 (0)