]> git.ipfire.org Git - thirdparty/git.git/commit - t/t4216-log-bloom.sh
t4000-t4999: detect and signal failure within loop
authorEric Sunshine <sunshine@sunshineco.com>
Thu, 9 Dec 2021 05:11:13 +0000 (00:11 -0500)
committerJunio C Hamano <gitster@pobox.com>
Mon, 13 Dec 2021 18:29:48 +0000 (10:29 -0800)
commitcbe1d9d630e529d3dd240eacf3d1c9799fef702b
tree5aaa08925285248af953dc01916f33b26d0eb142
parentdb5875aa9fe056c2db3a463989091c5f70d6c8d1
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>
16 files changed:
t/t4001-diff-rename.sh
t/t4012-diff-binary.sh
t/t4014-format-patch.sh
t/t4015-diff-whitespace.sh
t/t4018-diff-funcname.sh
t/t4024-diff-optimize-common.sh
t/t4038-diff-combined.sh
t/t4046-diff-unmerged.sh
t/t4049-diff-stat-count.sh
t/t4052-stat-output.sh
t/t4057-diff-combined-paths.sh
t/t4124-apply-ws-rule.sh
t/t4138-apply-ws-expansion.sh
t/t4205-log-pretty-formats.sh
t/t4211-line-log.sh
t/t4216-log-bloom.sh