l10n: README: fix typo
[alt-git.git] / t / t5617-clone-submodules-remote.sh
blobca8f80083a2f93bcef46a4a4e32c7a26150ef22e
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-lib.sh
10 pwd=$(pwd)
12 test_expect_success 'setup' '
13 git checkout -b main &&
14 test_commit commit1 &&
15 mkdir sub &&
17 cd sub &&
18 git init &&
19 test_commit subcommit1 &&
20 git tag sub_when_added_to_super &&
21 git branch other
22 ) &&
23 git submodule add "file://$pwd/sub" sub &&
24 git commit -m "add submodule" &&
26 cd sub &&
27 test_commit subcommit2
31 # bare clone giving "srv.bare" for use as our server.
32 test_expect_success 'setup bare clone for server' '
33 git clone --bare "file://$(pwd)/." srv.bare &&
34 git -C srv.bare config --local uploadpack.allowfilter 1 &&
35 git -C srv.bare config --local uploadpack.allowanysha1inwant 1
38 test_expect_success 'clone with --no-remote-submodules' '
39 test_when_finished "rm -rf super_clone" &&
40 git clone --recurse-submodules --no-remote-submodules "file://$pwd/." super_clone &&
42 cd super_clone/sub &&
43 git diff --exit-code sub_when_added_to_super
47 test_expect_success 'clone with --remote-submodules' '
48 test_when_finished "rm -rf super_clone" &&
49 git clone --recurse-submodules --remote-submodules "file://$pwd/." super_clone &&
51 cd super_clone/sub &&
52 git diff --exit-code remotes/origin/main
56 test_expect_success 'check the default is --no-remote-submodules' '
57 test_when_finished "rm -rf super_clone" &&
58 git clone --recurse-submodules "file://$pwd/." super_clone &&
60 cd super_clone/sub &&
61 git diff --exit-code sub_when_added_to_super
65 test_expect_success 'clone with --single-branch' '
66 test_when_finished "rm -rf super_clone" &&
67 git clone --recurse-submodules --single-branch "file://$pwd/." super_clone &&
69 cd super_clone/sub &&
70 git rev-parse --verify origin/main &&
71 test_must_fail git rev-parse --verify origin/other
75 # do basic partial clone from "srv.bare"
76 # confirm partial clone was registered in the local config for super and sub.
77 test_expect_success 'clone with --filter' '
78 git clone --recurse-submodules \
79 --filter blob:none --also-filter-submodules \
80 "file://$pwd/srv.bare" super_clone &&
81 test_cmp_config -C super_clone true remote.origin.promisor &&
82 test_cmp_config -C super_clone blob:none remote.origin.partialclonefilter &&
83 test_cmp_config -C super_clone/sub true remote.origin.promisor &&
84 test_cmp_config -C super_clone/sub blob:none remote.origin.partialclonefilter
87 # check that clone.filterSubmodules works (--also-filter-submodules can be
88 # omitted)
89 test_expect_success 'filters applied with clone.filterSubmodules' '
90 test_config_global clone.filterSubmodules true &&
91 git clone --recurse-submodules --filter blob:none \
92 "file://$pwd/srv.bare" super_clone2 &&
93 test_cmp_config -C super_clone2 true remote.origin.promisor &&
94 test_cmp_config -C super_clone2 blob:none remote.origin.partialclonefilter &&
95 test_cmp_config -C super_clone2/sub true remote.origin.promisor &&
96 test_cmp_config -C super_clone2/sub blob:none remote.origin.partialclonefilter
99 test_expect_success '--no-also-filter-submodules overrides clone.filterSubmodules=true' '
100 test_config_global clone.filterSubmodules true &&
101 git clone --recurse-submodules --filter blob:none \
102 --no-also-filter-submodules \
103 "file://$pwd/srv.bare" super_clone3 &&
104 test_cmp_config -C super_clone3 true remote.origin.promisor &&
105 test_cmp_config -C super_clone3 blob:none remote.origin.partialclonefilter &&
106 test_cmp_config -C super_clone3/sub false --default false remote.origin.promisor
109 test_done