summaryrefslogtreecommitdiff
path: root/t/t5614-clone-submodules.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2016-06-19 20:51:56 (GMT)
committerJunio C Hamano <gitster@pobox.com>2016-06-20 18:35:28 (GMT)
commit18a74a092bff41f1ffe10bd2463d3eed9a04435d (patch)
tree508b2f5bbad1fdf44e41f23c48dc5e14f2983d38 /t/t5614-clone-submodules.sh
parentd22eb044750631f30bdbfc3dc42d684e73d18ddc (diff)
downloadgit-18a74a092bff41f1ffe10bd2463d3eed9a04435d.zip
git-18a74a092bff41f1ffe10bd2463d3eed9a04435d.tar.gz
git-18a74a092bff41f1ffe10bd2463d3eed9a04435d.tar.bz2
clone: do not let --depth imply --shallow-submodules
In v2.9.0, we prematurely flipped the default to force cloning submodules shallowly, when the superproject is getting cloned shallowly. This is likely to fail when the upstream repositories submodules are cloned from a repository that is not prepared to serve histories that ends at a commit that is not at the tip of a branch, and we know the world is not yet ready. Use a safer default to clone the submodules fully, unless the user tells us that she knows that the upstream repository of the submodules are willing to cooperate with "--shallow-submodules" option. Noticed-by: Vadim Eisenberg <VADIME@il.ibm.com> Helped-by: Jeff King <peff@peff.net> Helped-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t5614-clone-submodules.sh')
-rwxr-xr-xt/t5614-clone-submodules.sh19
1 files changed, 17 insertions, 2 deletions
diff --git a/t/t5614-clone-submodules.sh b/t/t5614-clone-submodules.sh
index 62044c5..a9aaa01 100755
--- a/t/t5614-clone-submodules.sh
+++ b/t/t5614-clone-submodules.sh
@@ -37,9 +37,9 @@ test_expect_success 'nonshallow clone implies nonshallow submodule' '
)
'
-test_expect_success 'shallow clone implies shallow submodule' '
+test_expect_success 'shallow clone with shallow submodule' '
test_when_finished "rm -rf super_clone" &&
- git clone --recurse-submodules --depth 2 "file://$pwd/." super_clone &&
+ git clone --recurse-submodules --depth 2 --shallow-submodules "file://$pwd/." super_clone &&
(
cd super_clone &&
git log --oneline >lines &&
@@ -52,6 +52,21 @@ test_expect_success 'shallow clone implies shallow submodule' '
)
'
+test_expect_success 'shallow clone does not imply shallow submodule' '
+ test_when_finished "rm -rf super_clone" &&
+ git clone --recurse-submodules --depth 2 "file://$pwd/." super_clone &&
+ (
+ cd super_clone &&
+ git log --oneline >lines &&
+ test_line_count = 2 lines
+ ) &&
+ (
+ cd super_clone/sub &&
+ git log --oneline >lines &&
+ test_line_count = 3 lines
+ )
+'
+
test_expect_success 'shallow clone with non shallow submodule' '
test_when_finished "rm -rf super_clone" &&
git clone --recurse-submodules --depth 2 --no-shallow-submodules "file://$pwd/." super_clone &&