]>
Commit | Line | Data |
---|---|---|
a5adaced JK |
1 | #!/bin/sh |
2 | ||
3 | test_description='test disabling of git-over-ssh in clone/fetch' | |
c65d18cb ÆAB |
4 | |
5 | TEST_PASSES_SANITIZE_LEAK=true | |
a5adaced JK |
6 | . ./test-lib.sh |
7 | . "$TEST_DIRECTORY/lib-proto-disable.sh" | |
8 | ||
9 | setup_ssh_wrapper | |
10 | ||
11 | test_expect_success 'setup repository to clone' ' | |
12 | test_commit one && | |
13 | mkdir remote && | |
14 | git init --bare remote/repo.git && | |
15 | git push remote/repo.git HEAD | |
16 | ' | |
17 | ||
18 | test_proto "host:path" ssh "remote:repo.git" | |
681390b3 DK |
19 | test_proto "ssh://" ssh "ssh://remote$PWD/remote/repo.git" |
20 | test_proto "git+ssh://" ssh "git+ssh://remote$PWD/remote/repo.git" | |
a5adaced | 21 | |
2d90add5 JK |
22 | # Don't even bother setting up a "-remote" directory, as ssh would generally |
23 | # complain about the bogus option rather than completing our request. Our | |
24 | # fake wrapper actually _can_ handle this case, but it's more robust to | |
25 | # simply confirm from its output that it did not run at all. | |
26 | test_expect_success 'hostnames starting with dash are rejected' ' | |
27 | test_must_fail git clone ssh://-remote/repo.git dash-host 2>stderr && | |
28 | ! grep ^ssh: stderr | |
29 | ' | |
30 | ||
aeeb2d49 JK |
31 | test_expect_success 'setup repo with dash' ' |
32 | git init --bare remote/-repo.git && | |
33 | git push remote/-repo.git HEAD | |
34 | ' | |
35 | ||
36 | test_expect_success 'repo names starting with dash are rejected' ' | |
37 | test_must_fail git clone remote:-repo.git dash-path 2>stderr && | |
38 | ! grep ^ssh: stderr | |
39 | ' | |
40 | ||
41 | test_expect_success 'full paths still work' ' | |
42 | git clone "remote:$PWD/remote/-repo.git" dash-path | |
43 | ' | |
44 | ||
a5adaced | 45 | test_done |