Merge branch 'bc/hash-algo'
[git] / t / t5810-proto-disable-local.sh
1 #!/bin/sh
2
3 test_description='test disabling of local paths in clone/fetch'
4 . ./test-lib.sh
5 . "$TEST_DIRECTORY/lib-proto-disable.sh"
6
7 test_expect_success 'setup repository to clone' '
8         test_commit one
9 '
10
11 test_proto "file://" file "file://$PWD"
12 test_proto "path" file .
13
14 test_expect_success 'setup repo with dash' '
15         git init --bare repo.git &&
16         git push repo.git HEAD &&
17         mv repo.git "$PWD/-repo.git"
18 '
19
20 # This will fail even without our rejection because upload-pack will
21 # complain about the bogus option. So let's make sure that GIT_TRACE
22 # doesn't show us even running upload-pack.
23 #
24 # We must also be sure to use "fetch" and not "clone" here, as the latter
25 # actually canonicalizes our input into an absolute path (which is fine
26 # to allow).
27 test_expect_success 'repo names starting with dash are rejected' '
28         rm -f trace.out &&
29         test_must_fail env GIT_TRACE="$PWD/trace.out" git fetch -- -repo.git &&
30         ! grep upload-pack trace.out
31 '
32
33 test_expect_success 'full paths still work' '
34         git fetch "$PWD/-repo.git"
35 '
36
37 test_done