t7701: fix ignored exit code inside loop

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>
This commit is contained in:
Jeff King 2015-03-25 01:29:10 -04:00 committed by Junio C Hamano
parent 6636cf7e90
commit 76e057dba2

View file

@ -57,7 +57,7 @@ compare_mtimes ()
{
read tref rest &&
while read t rest; do
test "$tref" = "$t" || break
test "$tref" = "$t" || return 1
done
}