summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorLibravatar Patrick Steinhardt <ps@pks.im>2015-08-10 17:48:24 +0200
committerLibravatar Junio C Hamano <gitster@pobox.com>2015-08-10 11:02:07 -0700
commit92722efec01f67a54b68c83fcbc3cd65f9fbb7b8 (patch)
treeeefdfc349caa9a30a962a1ef67f9586abc3fc688 /t
parentclone: do not include authentication data in guessed dir (diff)
downloadtgif-92722efec01f67a54b68c83fcbc3cd65f9fbb7b8.tar.xz
clone: do not use port number as dir name
If the URI contains a port number and the URI's path component is empty we fail to guess a sensible directory name. E.g. cloning a repository 'ssh://example.com:2222/' we guess a directory name '2222' where we would want the hostname only, e.g. 'example.com'. We need to take care to not drop trailing port-like numbers in certain cases. E.g. when cloning a repository 'foo/bar:2222.git' we want to guess the directory name '2222' instead of 'bar'. Thus, we have to first check the stripped URI for path separators and only strip port numbers if there are path separators present. This heuristic breaks when cloning a repository 'bar:2222.git', though. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-xt/t5603-clone-dirname.sh14
1 files changed, 7 insertions, 7 deletions
diff --git a/t/t5603-clone-dirname.sh b/t/t5603-clone-dirname.sh
index 0307462b03..d5af758129 100755
--- a/t/t5603-clone-dirname.sh
+++ b/t/t5603-clone-dirname.sh
@@ -76,17 +76,17 @@ 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://host:1234/ host
test_clone_dir ssh://user@host/ host
-test_clone_dir host:/ host fail
+test_clone_dir host:/ host
# auth materials should be redacted
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
-test_clone_dir user:password@host:/ host fail
-test_clone_dir user:passw@rd@host:/ host fail
+test_clone_dir ssh://user:password@host:1234/ host
+test_clone_dir ssh://user:passw@rd@host:1234/ host
+test_clone_dir user@host:/ host
+test_clone_dir user:password@host:/ host
+test_clone_dir user:passw@rd@host:/ host
# auth-like material should not be dropped
test_clone_dir ssh://host/foo@bar foo@bar