]> git.ipfire.org Git - thirdparty/git.git/commit - t/t0021-conversion.sh
t0000-t3999: detect and signal failure within loop
authorEric Sunshine <sunshine@sunshineco.com>
Thu, 9 Dec 2021 05:11:12 +0000 (00:11 -0500)
committerJunio C Hamano <gitster@pobox.com>
Mon, 13 Dec 2021 18:29:48 +0000 (10:29 -0800)
commitdb5875aa9fe056c2db3a463989091c5f70d6c8d1
tree7009932d4396e0928ca5926ac985e30f1dcce33a
parentefe26b9ee09d53dda0f36d0ea20cb245b934f216
t0000-t3999: 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>
31 files changed:
t/perf/p0100-globbing.sh
t/perf/p1400-update-ref.sh
t/perf/p1451-fsck-skip-list.sh
t/perf/p3400-rebase.sh
t/perf/p5302-pack-index.sh
t/perf/p5303-many-packs.sh
t/perf/p7519-fsmonitor.sh
t/t0008-ignores.sh
t/t0011-hashmap.sh
t/t0021-conversion.sh
t/t0095-bloom.sh
t/t0410-partial-clone.sh
t/t1050-large.sh
t/t1091-sparse-checkout-builtin.sh
t/t1300-config.sh
t/t1400-update-ref.sh
t/t1403-show-ref.sh
t/t1410-reflog.sh
t/t1512-rev-parse-disambiguation.sh
t/t2004-checkout-cache-temp.sh
t/t2012-checkout-last.sh
t/t2200-add-update.sh
t/t2203-add-intent.sh
t/t3202-show-branch.sh
t/t3303-notes-subtrees.sh
t/t3305-notes-fanout.sh
t/t3404-rebase-interactive.sh
t/t3501-revert-cherry-pick.sh
t/t3508-cherry-pick-many-commits.sh
t/t3700-add.sh
t/t3920-crlf-messages.sh