perf-lib: fix ignored exit code inside loop
authorJeff King <peff@peff.net>
Wed, 25 Mar 2015 05:25:55 +0000 (01:25 -0400)
committerJunio C Hamano <gitster@pobox.com>
Wed, 25 Mar 2015 17:21:23 +0000 (10:21 -0700)
When copying the test repository, we try to detect whether
the copy succeeded. However, most of the heavy lifting is
done inside a for loop, where our "break" will lose the exit
code of the failing "cp". We can take advantage of the fact
that we are in a subshell, and just "exit 1" to break out
with a code.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/perf/perf-lib.sh
index a8c9574291b87d9bb1906a9d61faa9b157178b76..5cf74eddec7552140c5bef14f23fc637a2ad9818 100644 (file)
@@ -91,7 +91,7 @@ test_perf_create_repo_from () {
                                */objects|*/hooks|*/config)
                                        ;;
                                *)
-                                       cp -R "$stuff" . || break
+                                       cp -R "$stuff" . || exit 1
                                        ;;
                        esac
                done &&