3 test_description='check output directory names used by git-clone'
6 # we use a fake ssh wrapper that ignores the arguments
7 # entirely; we really only care that we get _some_ repo,
8 # as the real test is what clone does on the local side
9 test_expect_success 'setup ssh wrapper' '
10 write_script "$TRASH_DIRECTORY/ssh-wrapper" <<-\EOF &&
11 git upload-pack "$TRASH_DIRECTORY"
13 GIT_SSH="$TRASH_DIRECTORY/ssh-wrapper" &&
14 GIT_SSH_VARIANT=ssh &&
16 export GIT_SSH_VARIANT &&
17 export TRASH_DIRECTORY
20 # make sure that cloning $1 results in local directory $2
39 test_expect_$expect "clone of $url goes to $dir ($bare)" "
41 git clone $clone_opts $url &&
46 # basic syntax with bare and non-bare variants
47 test_clone_dir host:foo foo
48 test_clone_dir host:foo foo.git bare
49 test_clone_dir host:foo.git foo
50 test_clone_dir host:foo.git foo.git bare
51 test_clone_dir host:foo/.git foo
52 test_clone_dir host:foo/.git foo.git bare
54 # similar, but using ssh URL rather than host:path syntax
55 test_clone_dir ssh://host/foo foo
56 test_clone_dir ssh://host/foo foo.git bare
57 test_clone_dir ssh://host/foo.git foo
58 test_clone_dir ssh://host/foo.git foo.git bare
59 test_clone_dir ssh://host/foo/.git foo
60 test_clone_dir ssh://host/foo/.git foo.git bare
62 # we should remove trailing slashes and .git suffixes
63 test_clone_dir ssh://host/foo/ foo
64 test_clone_dir ssh://host/foo/// foo
65 test_clone_dir ssh://host/foo/.git/ foo
66 test_clone_dir ssh://host/foo.git/ foo
67 test_clone_dir ssh://host/foo.git/// foo
68 test_clone_dir ssh://host/foo///.git/ foo
69 test_clone_dir ssh://host/foo/.git/// foo
71 test_clone_dir host:foo/ foo
72 test_clone_dir host:foo/// foo
73 test_clone_dir host:foo.git/ foo
74 test_clone_dir host:foo/.git/ foo
75 test_clone_dir host:foo.git/// foo
76 test_clone_dir host:foo///.git/ foo
77 test_clone_dir host:foo/.git/// foo
79 # omitting the path should default to the hostname
80 test_clone_dir ssh://host/ host
81 test_clone_dir ssh://host:1234/ host
82 test_clone_dir ssh://user@host/ host
83 test_clone_dir host:/ host
85 # auth materials should be redacted
86 test_clone_dir ssh://user:password@host/ host
87 test_clone_dir ssh://user:password@host:1234/ host
88 test_clone_dir ssh://user:passw@rd@host:1234/ host
89 test_clone_dir user@host:/ host
90 test_clone_dir user:password@host:/ host
91 test_clone_dir user:passw@rd@host:/ host
93 # auth-like material should not be dropped
94 test_clone_dir ssh://host/foo@bar foo@bar
95 test_clone_dir ssh://host/foo@bar.git foo@bar
96 test_clone_dir ssh://user:password@host/foo@bar foo@bar
97 test_clone_dir ssh://user:passw@rd@host/foo@bar.git foo@bar
99 test_clone_dir host:/foo@bar foo@bar
100 test_clone_dir host:/foo@bar.git foo@bar
101 test_clone_dir user:password@host:/foo@bar foo@bar
102 test_clone_dir user:passw@rd@host:/foo@bar.git foo@bar
104 # trailing port-like numbers should not be stripped for paths
105 test_clone_dir ssh://user:password@host/test:1234 1234
106 test_clone_dir ssh://user:password@host/test:1234.git 1234