Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2016-05-07 00:45:43 +0300
committerJunio C Hamano <gitster@pobox.com>2016-05-07 00:45:43 +0300
commit5f3b21c1119abc7e19c988b399c7726d47bbb0d1 (patch)
tree1a89aa68fe3d548cf24de1476eaaf1e52e27d1e4 /builtin/clone.c
parentca158f4633e40fb8a6e7e6b78dc7ad559718a19b (diff)
parentd22eb044750631f30bdbfc3dc42d684e73d18ddc (diff)
Merge branch 'sb/clone-shallow-passthru'
"git clone" learned "--shallow-submodules" option. * sb/clone-shallow-passthru: clone: add `--shallow-submodules` flag
Diffstat (limited to 'builtin/clone.c')
-rw-r--r--builtin/clone.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/builtin/clone.c b/builtin/clone.c
index 6576ecf343..5f867e67d8 100644
--- a/builtin/clone.c
+++ b/builtin/clone.c
@@ -40,6 +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 char *option_template, *option_depth;
static char *option_origin = NULL;
static char *option_branch = NULL;
@@ -92,6 +93,8 @@ static struct option builtin_clone_options[] = {
N_("create a shallow clone of that depth")),
OPT_BOOL(0, "single-branch", &option_single_branch,
N_("clone only one branch, HEAD or --branch")),
+ OPT_BOOL(0, "shallow-submodules", &option_shallow_submodules,
+ N_("any cloned submodules will be shallow")),
OPT_STRING(0, "separate-git-dir", &real_git_dir, N_("gitdir"),
N_("separate git dir from working tree")),
OPT_STRING_LIST('c', "config", &option_config, N_("key=value"),
@@ -735,6 +738,10 @@ 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))
+ argv_array_push(&args, "--depth=1");
+
if (max_jobs != -1)
argv_array_pushf(&args, "--jobs=%d", max_jobs);