diff options
author | Jeff King <peff@peff.net> | 2015-03-25 01:29:52 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2015-03-25 10:25:27 -0700 |
commit | e6821d09e4655af94f9c8af07333ae710094996a (patch) | |
tree | f8c82901ba5cff198cd624354a06b907d88ebcf0 /t/t3010-ls-files-killed-modified.sh | |
parent | 76e057dba29af1f322a19cb75b2921010dbe459c (diff) | |
download | git-e6821d09e4655af94f9c8af07333ae710094996a.tar.gz |
t: fix some trivial cases of ignored exit codes in loops
These are all cases where we do a setup step of the form:
for i in $foo; do
set_up $i || break
done &&
more_setup
would not notice a failure in set_up (because break always
returns a 0 exit code). These are just setup steps that we
do not expect to fail, but it does not hurt to be defensive.
Most can be fixed by converting the "break" to a "return 1"
(since we eval our tests inside a function for just this
purpose). A few of the loops are inside subshells, so we can
use just "exit 1" to break out of the subshell. And a few
can actually be made shorter by just unrolling the loop.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t3010-ls-files-killed-modified.sh')
-rwxr-xr-x | t/t3010-ls-files-killed-modified.sh | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/t/t3010-ls-files-killed-modified.sh b/t/t3010-ls-files-killed-modified.sh index 62fce103f9..580e158f99 100755 --- a/t/t3010-ls-files-killed-modified.sh +++ b/t/t3010-ls-files-killed-modified.sh @@ -55,13 +55,10 @@ test_expect_success 'git update-index --add to add various paths.' ' : >path9 && date >path10 && git update-index --add -- path0 path?/file? pathx/ju path7 path8 path9 path10 && - for i in 1 2 - do - git init submod$i && - ( - cd submod$i && git commit --allow-empty -m "empty $i" - ) || break - done && + git init submod1 && + git -C submod1 commit --allow-empty -m "empty 1" && + git init submod2 && + git -C submod2 commit --allow-empty -m "empty 2" && git update-index --add submod[12] && ( cd submod1 && |