diff options
author | Patrick Steinhardt <ps@pks.im> | 2015-08-10 17:48:23 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2015-08-10 20:01:08 +0200 |
commit | e895986727dfc4105c497132540dafa8ed51ec0a (patch) | |
tree | 15b88bc28cc0b417f95fa7944a081cf939294a9c /t/t5603-clone-dirname.sh | |
parent | clone: use computed length in guess_dir_name (diff) | |
download | git-e895986727dfc4105c497132540dafa8ed51ec0a.tar.xz git-e895986727dfc4105c497132540dafa8ed51ec0a.zip |
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-x | t/t5603-clone-dirname.sh | 4 |
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 |