From 132f600b060c2db7fd3d450dfadb6779a61c648a Mon Sep 17 00:00:00 2001 From: Emily Shaffer Date: Thu, 20 Feb 2020 19:10:27 -0800 Subject: clone: pass --single-branch during --recurse-submodules Previously, performing "git clone --recurse-submodules --single-branch" resulted in submodules cloning all branches even though the superproject cloned only one branch. Pipe --single-branch through the submodule helper framework to make it to 'clone' later on. Signed-off-by: Emily Shaffer Acked-by: Jeff King Signed-off-by: Junio C Hamano --- t/t5617-clone-submodules-remote.sh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 't') diff --git a/t/t5617-clone-submodules-remote.sh b/t/t5617-clone-submodules-remote.sh index 37fcce9c40..1a041df10b 100755 --- a/t/t5617-clone-submodules-remote.sh +++ b/t/t5617-clone-submodules-remote.sh @@ -14,7 +14,8 @@ test_expect_success 'setup' ' cd sub && git init && test_commit subcommit1 && - git tag sub_when_added_to_super + git tag sub_when_added_to_super && + git branch other ) && git submodule add "file://$pwd/sub" sub && git commit -m "add submodule" && @@ -51,4 +52,14 @@ test_expect_success 'check the default is --no-remote-submodules' ' ) ' +test_expect_success 'clone with --single-branch' ' + test_when_finished "rm -rf super_clone" && + git clone --recurse-submodules --single-branch "file://$pwd/." super_clone && + ( + cd super_clone/sub && + git rev-parse --verify origin/master && + test_must_fail git rev-parse --verify origin/other + ) +' + test_done -- cgit v1.2.3