summaryrefslogtreecommitdiff
path: root/t/t7416-submodule-dash-url.sh
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2020-03-17 14:36:45 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2020-03-17 14:36:45 -0700
commit506223f9c5c8956f895f0342e4a6d4244b5fa570 (patch)
treeffc75038e07070badec6d9add8861de6dbeba740 /t/t7416-submodule-dash-url.sh
parentmsvc: accommodate for vcpkg's upgrade to OpenSSL v1.1.x (diff)
parentGit 2.23.2 (diff)
downloadtgif-506223f9c5c8956f895f0342e4a6d4244b5fa570.tar.xz
Git 2.24.2
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t7416-submodule-dash-url.sh')
-rwxr-xr-xt/t7416-submodule-dash-url.sh18
1 files changed, 17 insertions, 1 deletions
diff --git a/t/t7416-submodule-dash-url.sh b/t/t7416-submodule-dash-url.sh
index 5ba041f537..41431b1ac3 100755
--- a/t/t7416-submodule-dash-url.sh
+++ b/t/t7416-submodule-dash-url.sh
@@ -1,6 +1,6 @@
#!/bin/sh
-test_description='check handling of .gitmodule url with dash'
+test_description='check handling of disallowed .gitmodule urls'
. ./test-lib.sh
test_expect_success 'create submodule with protected dash in url' '
@@ -60,4 +60,20 @@ test_expect_success 'trailing backslash is handled correctly' '
test_i18ngrep ! "unknown option" err
'
+test_expect_success 'fsck rejects embedded newline in url' '
+ # create an orphan branch to avoid existing .gitmodules objects
+ git checkout --orphan newline &&
+ cat >.gitmodules <<-\EOF &&
+ [submodule "foo"]
+ url = "https://one.example.com?%0ahost=two.example.com/foo.git"
+ EOF
+ git add .gitmodules &&
+ git commit -m "gitmodules with newline" &&
+ test_when_finished "rm -rf dst" &&
+ git init --bare dst &&
+ git -C dst config transfer.fsckObjects true &&
+ test_must_fail git push dst HEAD 2>err &&
+ grep gitmodulesUrl err
+'
+
test_done