diff options
author | Eric Sunshine <sunshine@sunshineco.com> | 2022-08-22 20:26:42 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-08-22 21:53:02 +0200 |
commit | 0e66bc1b215b1dd2b0f05c5777eb8ee2ae4e9523 (patch) | |
tree | 12e41d0779a59a42f52889fb94e5607f8a273363 /t/t6429-merge-sequence-rename-caching.sh | |
parent | t1092: fix buggy sparse "blame" test (diff) | |
download | git-0e66bc1b215b1dd2b0f05c5777eb8ee2ae4e9523.tar.xz git-0e66bc1b215b1dd2b0f05c5777eb8ee2ae4e9523.zip |
t: detect and signal failure within loop
Failures within `for` and `while` loops can go unnoticed if not detected
and signaled manually since the loop itself does not abort when a
contained command fails, nor will a failure necessarily be detected when
the loop finishes since the loop returns the exit code of the last
command it ran on the final iteration, which may not be the command
which failed. Therefore, detect and signal failures manually within
loops using the idiom `|| return 1` (or `|| exit 1` within subshells).
Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t6429-merge-sequence-rename-caching.sh')
-rwxr-xr-x | t/t6429-merge-sequence-rename-caching.sh | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/t/t6429-merge-sequence-rename-caching.sh b/t/t6429-merge-sequence-rename-caching.sh index e1ce919916..650b3cd14f 100755 --- a/t/t6429-merge-sequence-rename-caching.sh +++ b/t/t6429-merge-sequence-rename-caching.sh @@ -725,7 +725,7 @@ test_expect_success 'avoid assuming we detected renames' ' mkdir unrelated && for i in $(test_seq 1 10) do - >unrelated/$i + >unrelated/$i || exit 1 done && test_seq 2 10 >numbers && test_seq 12 20 >values && |