Skip to content

Commit

Permalink
t7701: fix ignored exit code inside loop
Browse files Browse the repository at this point in the history
When checking a list of file mtimes, we use a loop and break
out early from the loop if any entry does not match.
However, the exit code of a loop exited via break is always
0, meaning that the test will fail to notice we had a
mismatch. Since the loop is inside a function, we can fix
this by doing an early "return 1".

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Jeff King authored and Junio C Hamano committed Mar 25, 2015
1 parent 6636cf7 commit 76e057d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion t/t7701-repack-unpack-unreachable.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ compare_mtimes ()
{
read tref rest &&
while read t rest; do
test "$tref" = "$t" || break
test "$tref" = "$t" || return 1
done
}

Expand Down

0 comments on commit 76e057d

Please sign in to comment.