]> git.ipfire.org Git - thirdparty/git.git/commit
t5000-t5999: detect and signal failure within loop
authorEric Sunshine <sunshine@sunshineco.com>
Thu, 9 Dec 2021 05:11:14 +0000 (00:11 -0500)
committerJunio C Hamano <gitster@pobox.com>
Mon, 13 Dec 2021 18:29:48 +0000 (10:29 -0800)
commitd0fd993137cf41be66b54628f124b6651eea0bd2
tree5cf3d6ab76f75dabaac0ddff6cdca03dcaaf289d
parentcbe1d9d630e529d3dd240eacf3d1c9799fef702b
t5000-t5999: 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>
20 files changed:
t/t5000-tar-tree.sh
t/t5003-archive-zip.sh
t/t5004-archive-corner-cases.sh
t/t5100-mailinfo.sh
t/t5300-pack-object.sh
t/t5307-pack-missing-commit.sh
t/t5310-pack-bitmaps.sh
t/t5317-pack-objects-filter-objects.sh
t/t5318-commit-graph.sh
t/t5319-multi-pack-index.sh
t/t5322-pack-objects-sparse.sh
t/t5325-reverse-index.sh
t/t5500-fetch-pack.sh
t/t5502-quickfetch.sh
t/t5510-fetch.sh
t/t5515-fetch-merge-logic.sh
t/t5552-skipping-fetch-negotiator.sh
t/t5571-pre-push-hook.sh
t/t5616-partial-clone.sh
t/t5702-protocol-v2.sh