t7800: improve test descriptions with empty arguments
[alt-git.git] / t / t5617-clone-submodules-remote.sh
blob5a4d7936a72aac48fde876076393956bb83d42e9
1 #!/bin/sh
3 test_description='Test cloning repos with submodules using remote-tracking branches'
5 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
6 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
8 TEST_PASSES_SANITIZE_LEAK=true
9 . ./test-lib.sh
11 pwd=$(pwd)
13 test_expect_success 'setup' '
14 git config --global protocol.file.allow always &&
15 git checkout -b main &&
16 test_commit commit1 &&
17 mkdir sub &&
19 cd sub &&
20 git init &&
21 test_commit subcommit1 &&
22 git tag sub_when_added_to_super &&
23 git branch other
24 ) &&
25 git submodule add "file://$pwd/sub" sub &&
26 git commit -m "add submodule" &&
28 cd sub &&
29 test_commit subcommit2
33 # bare clone giving "srv.bare" for use as our server.
34 test_expect_success 'setup bare clone for server' '
35 git clone --bare "file://$(pwd)/." srv.bare &&
36 git -C srv.bare config --local uploadpack.allowfilter 1 &&
37 git -C srv.bare config --local uploadpack.allowanysha1inwant 1
40 test_expect_success 'clone with --no-remote-submodules' '
41 test_when_finished "rm -rf super_clone" &&
42 git clone --recurse-submodules --no-remote-submodules "file://$pwd/." super_clone &&
44 cd super_clone/sub &&
45 git diff --exit-code sub_when_added_to_super
49 test_expect_success 'clone with --remote-submodules' '
50 test_when_finished "rm -rf super_clone" &&
51 git clone --recurse-submodules --remote-submodules "file://$pwd/." super_clone &&
53 cd super_clone/sub &&
54 git diff --exit-code remotes/origin/main
58 test_expect_success 'check the default is --no-remote-submodules' '
59 test_when_finished "rm -rf super_clone" &&
60 git clone --recurse-submodules "file://$pwd/." super_clone &&
62 cd super_clone/sub &&
63 git diff --exit-code sub_when_added_to_super
67 test_expect_success 'clone with --single-branch' '
68 test_when_finished "rm -rf super_clone" &&
69 git clone --recurse-submodules --single-branch "file://$pwd/." super_clone &&
71 cd super_clone/sub &&
72 git rev-parse --verify origin/main &&
73 test_must_fail git rev-parse --verify origin/other
77 # do basic partial clone from "srv.bare"
78 # confirm partial clone was registered in the local config for super and sub.
79 test_expect_success 'clone with --filter' '
80 git clone --recurse-submodules \
81 --filter blob:none --also-filter-submodules \
82 "file://$pwd/srv.bare" super_clone &&
83 test_cmp_config -C super_clone true remote.origin.promisor &&
84 test_cmp_config -C super_clone blob:none remote.origin.partialclonefilter &&
85 test_cmp_config -C super_clone/sub true remote.origin.promisor &&
86 test_cmp_config -C super_clone/sub blob:none remote.origin.partialclonefilter
89 # check that clone.filterSubmodules works (--also-filter-submodules can be
90 # omitted)
91 test_expect_success 'filters applied with clone.filterSubmodules' '
92 test_config_global clone.filterSubmodules true &&
93 git clone --recurse-submodules --filter blob:none \
94 "file://$pwd/srv.bare" super_clone2 &&
95 test_cmp_config -C super_clone2 true remote.origin.promisor &&
96 test_cmp_config -C super_clone2 blob:none remote.origin.partialclonefilter &&
97 test_cmp_config -C super_clone2/sub true remote.origin.promisor &&
98 test_cmp_config -C super_clone2/sub blob:none remote.origin.partialclonefilter
101 test_expect_success '--no-also-filter-submodules overrides clone.filterSubmodules=true' '
102 test_config_global clone.filterSubmodules true &&
103 git clone --recurse-submodules --filter blob:none \
104 --no-also-filter-submodules \
105 "file://$pwd/srv.bare" super_clone3 &&
106 test_cmp_config -C super_clone3 true remote.origin.promisor &&
107 test_cmp_config -C super_clone3 blob:none remote.origin.partialclonefilter &&
108 test_cmp_config -C super_clone3/sub false --default false remote.origin.promisor
111 test_done