]> git.ipfire.org Git - thirdparty/git.git/blob - t/t5815-submodule-protos.sh
hashmap: use *_entry APIs for iteration
[thirdparty/git.git] / t / t5815-submodule-protos.sh
1 #!/bin/sh
2
3 test_description='test protocol whitelisting with submodules'
4 . ./test-lib.sh
5 . "$TEST_DIRECTORY"/lib-proto-disable.sh
6
7 setup_ext_wrapper
8 setup_ssh_wrapper
9
10 test_expect_success 'setup repository with submodules' '
11 mkdir remote &&
12 git init remote/repo.git &&
13 (cd remote/repo.git && test_commit one) &&
14 # submodule-add should probably trust what we feed it on the cmdline,
15 # but its implementation is overly conservative.
16 GIT_ALLOW_PROTOCOL=ssh git submodule add remote:repo.git ssh-module &&
17 GIT_ALLOW_PROTOCOL=ext git submodule add "ext::fake-remote %S repo.git" ext-module &&
18 git commit -m "add submodules"
19 '
20
21 test_expect_success 'clone with recurse-submodules fails' '
22 test_must_fail git clone --recurse-submodules . dst
23 '
24
25 test_expect_success 'setup individual updates' '
26 rm -rf dst &&
27 git clone . dst &&
28 git -C dst submodule init
29 '
30
31 test_expect_success 'update of ssh allowed' '
32 git -C dst submodule update ssh-module
33 '
34
35 test_expect_success 'update of ext not allowed' '
36 test_must_fail git -C dst submodule update ext-module
37 '
38
39 test_expect_success 'user can override whitelist' '
40 GIT_ALLOW_PROTOCOL=ext git -C dst submodule update ext-module
41 '
42
43 test_done