diff options
author | Jeff King <peff@peff.net> | 2021-01-07 04:44:17 -0500 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-01-07 14:25:44 -0800 |
commit | 6aed56736b882f94c81293d1646d27d10241349c (patch) | |
tree | 71e2194d1e94b8688f89d1b710dd6cf062b5f3a3 /t/t7416-submodule-dash-url.sh | |
parent | a02ea577174ab8ed18f847cf1693f213e0b9c473 (diff) | |
download | git-6aed56736b882f94c81293d1646d27d10241349c.tar.gz |
fsck: reject .gitmodules git:// urls with newlines
The previous commit taught the clone/fetch client side to reject a
git:// URL with a newline in it. Let's also catch these when fscking a
.gitmodules file, which will give an earlier warning.
Note that it would be simpler to just complain about newline in _any_
URL, but an earlier tightening for http/ftp made sure we kept allowing
newlines for unknown protocols (and this is covered in the tests). So
we'll stick to that precedent.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t7416-submodule-dash-url.sh')
-rwxr-xr-x | t/t7416-submodule-dash-url.sh | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/t/t7416-submodule-dash-url.sh b/t/t7416-submodule-dash-url.sh index eec96e0ba9..d21dc8b009 100755 --- a/t/t7416-submodule-dash-url.sh +++ b/t/t7416-submodule-dash-url.sh @@ -201,4 +201,19 @@ test_expect_success 'fsck rejects embedded newline in relative url' ' grep gitmodulesUrl err ' +test_expect_success 'fsck rejects embedded newline in git url' ' + git checkout --orphan git-newline && + cat >.gitmodules <<-\EOF && + [submodule "foo"] + url = "git://example.com:1234/repo%0a.git" + EOF + git add .gitmodules && + git commit -m "git url 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 |