[PATCH 4/8] t7701: fix ignored exit code inside loop
- From
Jeff King <peff@peff.net>
- Date
- Mar 25, 2015, 05:29 UTC
- Message-ID
- <20150325052909.GD31924@peff.net>
- In-Reply-To
- <20150325052456.GA19394@peff.net>
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> --- t/t7701-repack-unpack-unreachable.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/t/t7701-repack-unpack-unreachable.sh b/t/t7701-repack-unpack-unreachable.sh index aad8a9c..b66e383 100755 --- a/t/t7701-repack-unpack-unreachable.sh +++ b/t/t7701-repack-unpack-unreachable.sh @@ -57,7 +57,7 @@ compare_mtimes () { read tref rest && while read t rest; do - test "$tref" = "$t" || break + test "$tref" = "$t" || return 1 done }
-- 2.3.4.635.gd6ffcfe