summaryrefslogtreecommitdiff
path: root/t/t1050-large.sh
diff options
context:
space:
mode:
authorLibravatar Eric Sunshine <sunshine@sunshineco.com>2021-12-09 00:11:10 -0500
committerLibravatar Junio C Hamano <gitster@pobox.com>2021-12-13 10:29:48 -0800
commit03949e33f58223dd2d8465f4dd8042e5e581fcef (patch)
treeb5d3ed0b3bc19d18309a7563e6045442bd2346fc /t/t1050-large.sh
parenttests: apply modern idiom for signaling test failure (diff)
downloadtgif-03949e33f58223dd2d8465f4dd8042e5e581fcef.tar.xz
tests: apply modern idiom for exiting loop upon failure
Rather than maintaining a flag indicating a failure within a loop and aborting the test when the loop ends if the flag is set, modern practice is to signal the failure immediately by exiting the loop early via `return 1` (or `exit 1` if inside a subshell). Simplify these loops by following the modern idiom. Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Reviewed-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t1050-large.sh')
-rwxr-xr-xt/t1050-large.sh26
1 files changed, 8 insertions, 18 deletions
diff --git a/t/t1050-large.sh b/t/t1050-large.sh
index 99ff2866b7..0e4267c723 100755
--- a/t/t1050-large.sh
+++ b/t/t1050-large.sh
@@ -51,27 +51,21 @@ EOF
test_expect_success 'add a large file or two' '
git add large1 huge large2 &&
# make sure we got a single packfile and no loose objects
- bad= count=0 idx= &&
+ count=0 idx= &&
for p in .git/objects/pack/pack-*.pack
do
count=$(( $count + 1 )) &&
- if test_path_is_file "$p" &&
- idx=${p%.pack}.idx && test_path_is_file "$idx"
- then
- continue
- fi
- bad=t
+ test_path_is_file "$p" &&
+ idx=${p%.pack}.idx &&
+ test_path_is_file "$idx" || return 1
done &&
- test -z "$bad" &&
test $count = 1 &&
cnt=$(git show-index <"$idx" | wc -l) &&
test $cnt = 2 &&
for l in .git/objects/$OIDPATH_REGEX
do
- test_path_is_file "$l" || continue
- bad=t
+ test_path_is_missing "$l" || return 1
done &&
- test -z "$bad" &&
# attempt to add another copy of the same
git add large3 &&
@@ -79,14 +73,10 @@ test_expect_success 'add a large file or two' '
for p in .git/objects/pack/pack-*.pack
do
count=$(( $count + 1 )) &&
- if test_path_is_file "$p" &&
- idx=${p%.pack}.idx && test_path_is_file "$idx"
- then
- continue
- fi
- bad=t
+ test_path_is_file "$p" &&
+ idx=${p%.pack}.idx &&
+ test_path_is_file "$idx" || return 1
done &&
- test -z "$bad" &&
test $count = 1
'