t/t4*: merge a "grep | sed" pipeline
[git.git] / t / t5815-submodule-protos.sh
blob4d5956cc18f0d7563baea9593e0ea2387e33cd57
1 #!/bin/sh
3 test_description='test protocol filtering with submodules'
4 . ./test-lib.sh
5 . "$TEST_DIRECTORY"/lib-proto-disable.sh
7 setup_ext_wrapper
8 setup_ssh_wrapper
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"
21 test_expect_success 'clone with recurse-submodules fails' '
22 test_must_fail git clone --recurse-submodules . dst
25 test_expect_success 'setup individual updates' '
26 rm -rf dst &&
27 git clone . dst &&
28 git -C dst submodule init
31 test_expect_success 'update of ssh allowed' '
32 git -C dst submodule update ssh-module
35 test_expect_success 'update of ext not allowed' '
36 test_must_fail git -C dst submodule update ext-module
39 test_expect_success 'user can filter protocols with GIT_ALLOW_PROTOCOL' '
40 GIT_ALLOW_PROTOCOL=ext git -C dst submodule update ext-module
43 test_done