diff options
author | Jens Lehmann <Jens.Lehmann@web.de> | 2010-11-11 00:55:02 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2010-11-12 15:06:03 -0800 |
commit | be254a0ea99b441a6c514cb8b25cd72357383700 (patch) | |
tree | 2bd92c9b1ad1c034f5f23945a2ac19530f841bd8 /submodule.c | |
parent | 7dce19d374a37932e9d4c3a6202af407cf5114eb (diff) | |
download | git-be254a0ea99b441a6c514cb8b25cd72357383700.tar.gz |
Add the 'fetch.recurseSubmodules' config setting
This new boolean option can be used to override the default for "git
fetch" and "git pull", which is to not recurse into populated submodules
and fetch all new commits there too.
Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'submodule.c')
-rw-r--r-- | submodule.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/submodule.c b/submodule.c index 4d9b774cd1..01d75f528b 100644 --- a/submodule.c +++ b/submodule.c @@ -11,6 +11,7 @@ struct string_list config_name_for_path; struct string_list config_ignore_for_name; +static int config_fetch_recurse_submodules; static int add_submodule_odb(const char *path) { @@ -67,6 +68,10 @@ int submodule_config(const char *var, const char *value, void *cb) { if (!prefixcmp(var, "submodule.")) return parse_submodule_config_option(var, value); + else if (!strcmp(var, "fetch.recursesubmodules")) { + config_fetch_recurse_submodules = git_config_bool(var, value); + return 0; + } return 0; } @@ -229,8 +234,14 @@ void show_submodule_summary(FILE *f, const char *path, strbuf_release(&sb); } +void set_config_fetch_recurse_submodules(int value) +{ + config_fetch_recurse_submodules = value; +} + int fetch_populated_submodules(int num_options, const char **options, - const char *prefix, int quiet) + const char *prefix, int ignore_config, + int quiet) { int i, result = 0, argc = 0; struct child_process cp; @@ -271,6 +282,11 @@ int fetch_populated_submodules(int num_options, const char **options, if (name_for_path) name = name_for_path->util; + if (!ignore_config) { + if (!config_fetch_recurse_submodules) + continue; + } + strbuf_addf(&submodule_path, "%s/%s", work_tree, ce->name); strbuf_addf(&submodule_git_dir, "%s/.git", submodule_path.buf); strbuf_addf(&submodule_prefix, "%s%s/", prefix, ce->name); |