leak tests: mark some clone tests as passing with SANITIZE=leak
[git/debian.git] / t / t5603-clone-dirname.sh
blob8ca1f0942378d27e509e248fc1ea3346b26ef9db
1 #!/bin/sh
3 test_description='check output directory names used by git-clone'
5 TEST_PASSES_SANITIZE_LEAK=true
6 . ./test-lib.sh
8 # we use a fake ssh wrapper that ignores the arguments
9 # entirely; we really only care that we get _some_ repo,
10 # as the real test is what clone does on the local side
11 test_expect_success 'setup ssh wrapper' '
12 write_script "$TRASH_DIRECTORY/ssh-wrapper" <<-\EOF &&
13 git upload-pack "$TRASH_DIRECTORY"
14 EOF
15 GIT_SSH="$TRASH_DIRECTORY/ssh-wrapper" &&
16 GIT_SSH_VARIANT=ssh &&
17 export GIT_SSH &&
18 export GIT_SSH_VARIANT &&
19 export TRASH_DIRECTORY
22 # make sure that cloning $1 results in local directory $2
23 test_clone_dir () {
24 url=$1; shift
25 dir=$1; shift
26 expect=success
27 bare=non-bare
28 clone_opts=
29 for i in "$@"
31 case "$i" in
32 fail)
33 expect=failure
35 bare)
36 bare=bare
37 clone_opts=--bare
39 esac
40 done
41 test_expect_$expect "clone of $url goes to $dir ($bare)" "
42 rm -rf $dir &&
43 git clone $clone_opts $url &&
44 test_path_is_dir $dir
48 # basic syntax with bare and non-bare variants
49 test_clone_dir host:foo foo
50 test_clone_dir host:foo foo.git bare
51 test_clone_dir host:foo.git foo
52 test_clone_dir host:foo.git foo.git bare
53 test_clone_dir host:foo/.git foo
54 test_clone_dir host:foo/.git foo.git bare
56 # similar, but using ssh URL rather than host:path syntax
57 test_clone_dir ssh://host/foo foo
58 test_clone_dir ssh://host/foo foo.git bare
59 test_clone_dir ssh://host/foo.git foo
60 test_clone_dir ssh://host/foo.git foo.git bare
61 test_clone_dir ssh://host/foo/.git foo
62 test_clone_dir ssh://host/foo/.git foo.git bare
64 # we should remove trailing slashes and .git suffixes
65 test_clone_dir ssh://host/foo/ foo
66 test_clone_dir ssh://host/foo/// 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
70 test_clone_dir ssh://host/foo///.git/ foo
71 test_clone_dir ssh://host/foo/.git/// foo
73 test_clone_dir host:foo/ foo
74 test_clone_dir host:foo/// 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
78 test_clone_dir host:foo///.git/ foo
79 test_clone_dir host:foo/.git/// foo
81 # omitting the path should default to the hostname
82 test_clone_dir ssh://host/ host
83 test_clone_dir ssh://host:1234/ host
84 test_clone_dir ssh://user@host/ host
85 test_clone_dir host:/ host
87 # auth materials should be redacted
88 test_clone_dir ssh://user:password@host/ host
89 test_clone_dir ssh://user:password@host:1234/ host
90 test_clone_dir ssh://user:passw@rd@host:1234/ host
91 test_clone_dir user@host:/ host
92 test_clone_dir user:password@host:/ host
93 test_clone_dir user:passw@rd@host:/ host
95 # auth-like material should not be dropped
96 test_clone_dir ssh://host/foo@bar foo@bar
97 test_clone_dir ssh://host/foo@bar.git foo@bar
98 test_clone_dir ssh://user:password@host/foo@bar foo@bar
99 test_clone_dir ssh://user:passw@rd@host/foo@bar.git foo@bar
101 test_clone_dir host:/foo@bar foo@bar
102 test_clone_dir host:/foo@bar.git foo@bar
103 test_clone_dir user:password@host:/foo@bar foo@bar
104 test_clone_dir user:passw@rd@host:/foo@bar.git foo@bar
106 # trailing port-like numbers should not be stripped for paths
107 test_clone_dir ssh://user:password@host/test:1234 1234
108 test_clone_dir ssh://user:password@host/test:1234.git 1234
110 test_done