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
12 test_expect_success
'setup' '
13 git checkout -b main &&
14 test_commit commit1 &&
19 test_commit subcommit1 &&
20 git tag sub_when_added_to_super &&
23 git submodule add "file://$pwd/sub" sub &&
24 git commit -m "add submodule" &&
27 test_commit subcommit2
31 test_expect_success
'clone with --no-remote-submodules' '
32 test_when_finished "rm -rf super_clone" &&
33 git clone --recurse-submodules --no-remote-submodules "file://$pwd/." super_clone &&
36 git diff --exit-code sub_when_added_to_super
40 test_expect_success
'clone with --remote-submodules' '
41 test_when_finished "rm -rf super_clone" &&
42 git clone --recurse-submodules --remote-submodules "file://$pwd/." super_clone &&
45 git diff --exit-code remotes/origin/main
49 test_expect_success
'check the default is --no-remote-submodules' '
50 test_when_finished "rm -rf super_clone" &&
51 git clone --recurse-submodules "file://$pwd/." super_clone &&
54 git diff --exit-code sub_when_added_to_super
58 test_expect_success
'clone with --single-branch' '
59 test_when_finished "rm -rf super_clone" &&
60 git clone --recurse-submodules --single-branch "file://$pwd/." super_clone &&
63 git rev-parse --verify origin/main &&
64 test_must_fail git rev-parse --verify origin/other