t: detect and signal failure within loop
commit0e66bc1b215b1dd2b0f05c5777eb8ee2ae4e9523
authorEric Sunshine <sunshine@sunshineco.com>
Mon, 22 Aug 2022 18:26:42 +0000 (22 18:26 +0000)
committerJunio C Hamano <gitster@pobox.com>
Mon, 22 Aug 2022 19:53:02 +0000 (22 12:53 -0700)
tree12e41d0779a59a42f52889fb94e5607f8a273363
parent625ff5c3201186cedb856678907a3f4bd88406a6
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>
t/perf/p7527-builtin-fsmonitor.sh
t/t1092-sparse-checkout-compatibility.sh
t/t5329-pack-objects-cruft.sh
t/t6429-merge-sequence-rename-caching.sh