summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2016-06-20 18:01:01 (GMT)
committerJunio C Hamano <gitster@pobox.com>2016-06-20 18:01:01 (GMT)
commit3807098cd6abf4b94b6e0326255e5f5f0577f975 (patch)
tree34d2bb8e5c9ae4f9409c2cfdd6206ec32a5ff5d0 /builtin
parentde76eb69d2359f4820b120e49be9a30067bb5d3b (diff)
parentabed000acafd8aa86e02bcbb65fc1a8e4f06b8a0 (diff)
downloadgit-3807098cd6abf4b94b6e0326255e5f5f0577f975.zip
git-3807098cd6abf4b94b6e0326255e5f5f0577f975.tar.gz
git-3807098cd6abf4b94b6e0326255e5f5f0577f975.tar.bz2
Merge branch 'sb/submodule-recommend-shallowness'
An upstream project can make a recommendation to shallowly clone some submodules in the .gitmodules file it ships. * sb/submodule-recommend-shallowness: submodule update: learn `--[no-]recommend-shallow` option submodule-config: keep shallow recommendation around
Diffstat (limited to 'builtin')
-rw-r--r--builtin/submodule--helper.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c
index 926d205..c7deb55 100644
--- a/builtin/submodule--helper.c
+++ b/builtin/submodule--helper.c
@@ -579,6 +579,7 @@ struct submodule_update_clone {
/* configuration parameters which are passed on to the children */
int quiet;
+ int recommend_shallow;
const char *reference;
const char *depth;
const char *recursive_prefix;
@@ -591,7 +592,7 @@ struct submodule_update_clone {
unsigned quickstop : 1;
};
#define SUBMODULE_UPDATE_CLONE_INIT {0, MODULE_LIST_INIT, 0, \
- SUBMODULE_UPDATE_STRATEGY_INIT, 0, NULL, NULL, NULL, NULL, \
+ SUBMODULE_UPDATE_STRATEGY_INIT, 0, -1, NULL, NULL, NULL, NULL, \
STRING_LIST_INIT_DUP, 0}
@@ -696,6 +697,8 @@ static int prepare_to_clone_next_submodule(const struct cache_entry *ce,
argv_array_push(&child->args, "--quiet");
if (suc->prefix)
argv_array_pushl(&child->args, "--prefix", suc->prefix, NULL);
+ if (suc->recommend_shallow && sub->recommend_shallow == 1)
+ argv_array_push(&child->args, "--depth=1");
argv_array_pushl(&child->args, "--path", sub->path, NULL);
argv_array_pushl(&child->args, "--name", sub->name, NULL);
argv_array_pushl(&child->args, "--url", url, NULL);
@@ -778,6 +781,8 @@ static int update_clone(int argc, const char **argv, const char *prefix)
"specified number of revisions")),
OPT_INTEGER('j', "jobs", &max_jobs,
N_("parallel jobs")),
+ OPT_BOOL(0, "recommend-shallow", &suc.recommend_shallow,
+ N_("whether the initial clone should follow the shallow recommendation")),
OPT__QUIET(&suc.quiet, N_("don't print cloning progress")),
OPT_END()
};