t3305: fix ignored exit code inside loop
authorJeff King <redacted>
Wed, 25 Mar 2015 05:28:57 +0000 (01:28 -0400)
committerJunio C Hamano <redacted>
Wed, 25 Mar 2015 17:23:58 +0000 (10:23 -0700)
commit6636cf7e907d889eb69fe645198e58c773b2f755
treea5b780236a350e1e5f325f9ea2f756cbd60b7832
parentfd7771415b9447c8e53dd99d7946e00ee212d70d
t3305: fix ignored exit code inside loop

When we test deleting notes, we run "git notes remove" in a
loop. However, the exit value of the loop will only reflect
the final note we process. We should break out of the loop
with a failing exit code as soon as we see a problem.

Note that we can call "exit 1" here without explicitly
creating a subshell, because the while loop on the
right-hand side of a pipe executes in its own implicit
subshell.

Note also that the "break" above does not suffer the same
problem; it is meant to exit the loop early at a certain
number of iterations. We can bump it into the conditional of
the loop to make this more obvious.

Signed-off-by: Jeff King <redacted>
Acked-by: Johan Herland <redacted>
Signed-off-by: Junio C Hamano <redacted>
t/t3305-notes-fanout.sh
git clone https://git.99rst.org/PROJECT