3 test_description
='test disabling of local paths in clone/fetch'
5 TEST_PASSES_SANITIZE_LEAK
=true
7 .
"$TEST_DIRECTORY/lib-proto-disable.sh"
9 test_expect_success
'setup repository to clone' '
13 test_proto
"file://" file "file://$PWD"
14 test_proto
"path" file .
16 test_expect_success
'setup repo with dash' '
17 git init --bare repo.git &&
18 git push repo.git HEAD &&
19 mv repo.git "$PWD/-repo.git"
22 # This will fail even without our rejection because upload-pack will
23 # complain about the bogus option. So let's make sure that GIT_TRACE
24 # doesn't show us even running upload-pack.
26 # We must also be sure to use "fetch" and not "clone" here, as the latter
27 # actually canonicalizes our input into an absolute path (which is fine
29 test_expect_success
'repo names starting with dash are rejected' '
31 test_must_fail env GIT_TRACE="$PWD/trace.out" git fetch -- -repo.git &&
32 ! grep upload-pack trace.out
35 test_expect_success
'full paths still work' '
36 git fetch "$PWD/-repo.git"