Merge branch 'rs/parse-options-cmdmode'
[alt-git.git] / t / t5810-proto-disable-local.sh
blob862610256fb082a9ed62547cc51dc0a3cb754c48
1 #!/bin/sh
3 test_description='test disabling of local paths in clone/fetch'
5 TEST_PASSES_SANITIZE_LEAK=true
6 . ./test-lib.sh
7 . "$TEST_DIRECTORY/lib-proto-disable.sh"
9 test_expect_success 'setup repository to clone' '
10 test_commit one
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
28 # to allow).
29 test_expect_success 'repo names starting with dash are rejected' '
30 rm -f trace.out &&
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"
39 test_done