]> git.ipfire.org Git - thirdparty/git.git/blob - t/t5810-proto-disable-local.sh
Merge branch 'rs/diff-parseopts-cleanup'
[thirdparty/git.git] / t / t5810-proto-disable-local.sh
1 #!/bin/sh
2
3 test_description='test disabling of local paths in clone/fetch'
4
5 TEST_PASSES_SANITIZE_LEAK=true
6 . ./test-lib.sh
7 . "$TEST_DIRECTORY/lib-proto-disable.sh"
8
9 test_expect_success 'setup repository to clone' '
10 test_commit one
11 '
12
13 test_proto "file://" file "file://$PWD"
14 test_proto "path" file .
15
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"
20 '
21
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.
25 #
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
33 '
34
35 test_expect_success 'full paths still work' '
36 git fetch "$PWD/-repo.git"
37 '
38
39 test_done