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>
Jeff King committed
Mar 25, 2015 at 01:29 UTC
76e057dba29af1f322a19cb75b2921010dbe459c
1 file changed
+1
-1
t/t7701-repack-unpack-unreachable.sh
+1
-1
@@ -57,7 +57,7 @@ compare_mtimes ()
57
{
58
read tref rest &&
59
while read t rest; do
60
- test "$tref" = "$t" || break
60
+ test "$tref" = "$t" || return 1
61
done
62
}
63