summaryrefslogtreecommitdiff
path: root/t/t5505-remote.sh
diff options
context:
space:
mode:
authorEric Sunshine <sunshine@sunshineco.com>2021-12-09 05:11:10 (GMT)
committerJunio C Hamano <gitster@pobox.com>2021-12-13 18:29:48 (GMT)
commit03949e33f58223dd2d8465f4dd8042e5e581fcef (patch)
treeb5d3ed0b3bc19d18309a7563e6045442bd2346fc /t/t5505-remote.sh
parent77b1d9f355b44b68b4bb08a8143d13330fe4c562 (diff)
downloadgit-03949e33f58223dd2d8465f4dd8042e5e581fcef.zip
git-03949e33f58223dd2d8465f4dd8042e5e581fcef.tar.gz
git-03949e33f58223dd2d8465f4dd8042e5e581fcef.tar.bz2
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/t5505-remote.sh')
-rwxr-xr-xt/t5505-remote.sh6
1 files changed, 2 insertions, 4 deletions
diff --git a/t/t5505-remote.sh b/t/t5505-remote.sh
index e6e3c8f..5ef8db4 100755
--- a/t/t5505-remote.sh
+++ b/t/t5505-remote.sh
@@ -1332,7 +1332,6 @@ test_expect_success 'unqualified <dst> refspec DWIM and advice' '
(
cd test &&
git tag -a -m "Some tag" some-tag main &&
- exit_with=true &&
for type in commit tag tree blob
do
if test "$type" = "blob"
@@ -1348,9 +1347,8 @@ test_expect_success 'unqualified <dst> refspec DWIM and advice' '
push origin $oid:dst 2>err &&
test_i18ngrep "error: The destination you" err &&
test_i18ngrep ! "hint: Did you mean" err ||
- exit_with=false
- done &&
- $exit_with
+ exit 1
+ done
)
'