Skip to content

Commit

Permalink
perf-lib: fix ignored exit code inside loop
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jeff King authored and Junio C Hamano committed Mar 25, 2015
1 parent 65e6758 commit ecb590a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion t/perf/perf-lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ test_perf_create_repo_from () {
*/objects|*/hooks|*/config)
;;
*)
cp -R "$stuff" . || break
cp -R "$stuff" . || exit 1
;;
esac
done &&
Expand Down

0 comments on commit ecb590a

Please sign in to comment.