Merge branch 'rj/cygwin-has-dev-tty'
[git/gitster.git] / t / t5815-submodule-protos.sh
blobfe899ee82d74a20be4d230289bbb3e8ae619f07e
1 #!/bin/sh
3 test_description='test protocol filtering with submodules'
5 TEST_PASSES_SANITIZE_LEAK=true
6 . ./test-lib.sh
7 . "$TEST_DIRECTORY"/lib-proto-disable.sh
9 setup_ext_wrapper
10 setup_ssh_wrapper
12 test_expect_success 'setup repository with submodules' '
13 mkdir remote &&
14 git init remote/repo.git &&
15 (cd remote/repo.git && test_commit one) &&
16 # submodule-add should probably trust what we feed it on the cmdline,
17 # but its implementation is overly conservative.
18 GIT_ALLOW_PROTOCOL=ssh git submodule add remote:repo.git ssh-module &&
19 GIT_ALLOW_PROTOCOL=ext git submodule add "ext::fake-remote %S repo.git" ext-module &&
20 git commit -m "add submodules"
23 test_expect_success 'clone with recurse-submodules fails' '
24 test_must_fail git clone --recurse-submodules . dst
27 test_expect_success 'setup individual updates' '
28 rm -rf dst &&
29 git clone . dst &&
30 git -C dst submodule init
33 test_expect_success 'update of ssh allowed' '
34 git -C dst submodule update ssh-module
37 test_expect_success 'update of ext not allowed' '
38 test_must_fail git -C dst submodule update ext-module
41 test_expect_success 'user can filter protocols with GIT_ALLOW_PROTOCOL' '
42 GIT_ALLOW_PROTOCOL=ext git -C dst submodule update ext-module
45 test_done