From 18a74a092bff41f1ffe10bd2463d3eed9a04435d Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Sun, 19 Jun 2016 13:51:56 -0700 Subject: 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 Helped-by: Jeff King Helped-by: Stefan Beller Signed-off-by: Junio C Hamano --- builtin/clone.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'builtin/clone.c') diff --git a/builtin/clone.c b/builtin/clone.c index ecdf3080a..f267742e9 100644 --- a/builtin/clone.c +++ b/builtin/clone.c @@ -40,7 +40,7 @@ static const char * const builtin_clone_usage[] = { static int option_no_checkout, option_bare, option_mirror, option_single_branch = -1; static int option_local = -1, option_no_hardlinks, option_shared, option_recursive; -static int option_shallow_submodules = -1; +static int option_shallow_submodules; static char *option_template, *option_depth; static char *option_origin = NULL; static char *option_branch = NULL; @@ -730,8 +730,7 @@ static int checkout(void) struct argv_array args = ARGV_ARRAY_INIT; argv_array_pushl(&args, "submodule", "update", "--init", "--recursive", NULL); - if (option_shallow_submodules == 1 - || (option_shallow_submodules == -1 && option_depth)) + if (option_shallow_submodules == 1) argv_array_push(&args, "--depth=1"); if (max_jobs != -1) -- cgit v1.2.1