diff options
author | Jeff King <peff@peff.net> | 2015-03-25 01:30:17 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2015-03-25 12:49:33 -0700 |
commit | c6587bddc4e8a3ee2eef98a0a5cf15542a9cc849 (patch) | |
tree | da1d8467e0c8a0a20e838b7e067ba1be7d896640 /t/t3060-ls-files-with-tree.sh | |
parent | e6821d09e4655af94f9c8af07333ae710094996a (diff) | |
download | git-c6587bddc4e8a3ee2eef98a0a5cf15542a9cc849.tar.gz |
t: simplify loop exit-code status variables
Since shell loops may drop the exit code of failed commands
inside the loop, some tests try to keep track of the status
by setting a variable. This can end up cumbersome and hard
to read; it is much simpler to just exit directly from the
loop using "return 1" (since each case is either in a helper
function or inside a test snippet).
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t3060-ls-files-with-tree.sh')
-rwxr-xr-x | t/t3060-ls-files-with-tree.sh | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/t/t3060-ls-files-with-tree.sh b/t/t3060-ls-files-with-tree.sh index 61c1f53d1b..44f378ce41 100755 --- a/t/t3060-ls-files-with-tree.sh +++ b/t/t3060-ls-files-with-tree.sh @@ -18,22 +18,16 @@ test_expect_success setup ' echo file >expected && mkdir sub && - bad= && for n in 0 1 2 3 4 5 do for m in 0 1 2 3 4 5 6 7 8 9 do num=00$n$m && >sub/file-$num && - echo file-$num >>expected || { - bad=t - break - } - done && test -z "$bad" || { - bad=t - break - } - done && test -z "$bad" && + echo file-$num >>expected || + return 1 + done + done && git add . && git commit -m "add a bunch of files" && |