Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2015-08-10 18:48:23 +0300
committerJunio C Hamano <gitster@pobox.com>2015-08-10 21:01:08 +0300
commite895986727dfc4105c497132540dafa8ed51ec0a (patch)
tree15b88bc28cc0b417f95fa7944a081cf939294a9c /t/t5603-clone-dirname.sh
parentdb2e220447f7b02278d64417c8f05f73710f5b8b (diff)
clone: do not include authentication data in guessed dir
If the URI contains authentication data and the URI's path component is empty, we fail to guess a sensible directory name. E.g. cloning a repository 'ssh://user:password@example.com/' we guess a directory name 'password@example.com' where we would want the hostname only, e.g. 'example.com'. The naive way of just adding '@' as a path separator would break cloning repositories like 'foo/bar@baz.git' (which would currently become 'bar@baz' but would then become 'baz' only). Instead fix this by first dropping the scheme and then greedily scanning for an '@' sign until we find the first path separator. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t5603-clone-dirname.sh')
-rwxr-xr-xt/t5603-clone-dirname.sh4
1 files changed, 2 insertions, 2 deletions
diff --git a/t/t5603-clone-dirname.sh b/t/t5603-clone-dirname.sh
index 765cc434ef..0307462b03 100755
--- a/t/t5603-clone-dirname.sh
+++ b/t/t5603-clone-dirname.sh
@@ -77,11 +77,11 @@ test_clone_dir host:foo/.git/// foo
# omitting the path should default to the hostname
test_clone_dir ssh://host/ host
test_clone_dir ssh://host:1234/ host fail
-test_clone_dir ssh://user@host/ host fail
+test_clone_dir ssh://user@host/ host
test_clone_dir host:/ host fail
# auth materials should be redacted
-test_clone_dir ssh://user:password@host/ host fail
+test_clone_dir ssh://user:password@host/ host
test_clone_dir ssh://user:password@host:1234/ host fail
test_clone_dir ssh://user:passw@rd@host:1234/ host fail
test_clone_dir user@host:/ host fail