diff options
author | Eric Sunshine <sunshine@sunshineco.com> | 2021-12-09 08:11:13 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-12-13 21:29:48 +0300 |
commit | cbe1d9d630e529d3dd240eacf3d1c9799fef702b (patch) | |
tree | 5aaa08925285248af953dc01916f33b26d0eb142 /t/t4216-log-bloom.sh | |
parent | db5875aa9fe056c2db3a463989091c5f70d6c8d1 (diff) |
t4000-t4999: 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>
Reviewed-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t4216-log-bloom.sh')
-rwxr-xr-x | t/t4216-log-bloom.sh | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/t/t4216-log-bloom.sh b/t/t4216-log-bloom.sh index 50f206db55..41355f038b 100755 --- a/t/t4216-log-bloom.sh +++ b/t/t4216-log-bloom.sh @@ -376,7 +376,7 @@ test_expect_success 'Bloom generation backfills empty commits' ' cd empty && for i in $(test_seq 1 6) do - git commit --allow-empty -m "$i" + git commit --allow-empty -m "$i" || return 1 done && # Generate Bloom filters for empty commits 1-6, two at a time. @@ -389,7 +389,7 @@ test_expect_success 'Bloom generation backfills empty commits' ' test_filter_computed 2 trace.event && test_filter_not_computed 4 trace.event && test_filter_trunc_empty 2 trace.event && - test_filter_trunc_large 0 trace.event + test_filter_trunc_large 0 trace.event || return 1 done && # Finally, make sure that once all commits have filters, that |