summaryrefslogtreecommitdiff
path: root/t/t5505-remote.sh
diff options
context:
space:
mode:
authorLibravatar Sean Barag <sean@barag.org>2020-10-01 03:46:12 +0000
committerLibravatar Junio C Hamano <gitster@pobox.com>2020-09-30 22:09:13 -0700
commit444825c7c1148c0a38708238467c33ba370c58b2 (patch)
treea6522dae3a19b78ee84d907df854b61e06003cf7 /t/t5505-remote.sh
parentclone: use more conventional config/option layering (diff)
downloadtgif-444825c7c1148c0a38708238467c33ba370c58b2.tar.xz
remote: add tests for add and rename with invalid names
In preparation for a future patch that moves `builtin/remote.c`'s remote-name validation, ensure `git remote add` and `git remote rename` report errors when the new name isn't valid. Signed-off-by: Sean Barag <sean@barag.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t5505-remote.sh')
-rwxr-xr-xt/t5505-remote.sh13
1 files changed, 13 insertions, 0 deletions
diff --git a/t/t5505-remote.sh b/t/t5505-remote.sh
index 8d62edd98b..1156f52069 100755
--- a/t/t5505-remote.sh
+++ b/t/t5505-remote.sh
@@ -179,6 +179,13 @@ test_expect_success 'rename errors out early when deleting non-existent branch'
)
'
+test_expect_success 'rename errors out early when when new name is invalid' '
+ test_config remote.foo.vcs bar &&
+ echo "fatal: '\''invalid...name'\'' is not a valid remote name" >expect &&
+ test_must_fail git remote rename foo invalid...name 2>actual &&
+ test_i18ncmp expect actual
+'
+
test_expect_success 'add existing foreign_vcs remote' '
test_config remote.foo.vcs bar &&
echo "fatal: remote foo already exists." >expect &&
@@ -194,6 +201,12 @@ test_expect_success 'add existing foreign_vcs remote' '
test_i18ncmp expect actual
'
+test_expect_success 'add invalid foreign_vcs remote' '
+ echo "fatal: '\''invalid...name'\'' is not a valid remote name" >expect &&
+ test_must_fail git remote add invalid...name bar 2>actual &&
+ test_i18ncmp expect actual
+'
+
cat >test/expect <<EOF
* remote origin
Fetch URL: $(pwd)/one