From be254a0ea99b441a6c514cb8b25cd72357383700 Mon Sep 17 00:00:00 2001 From: Jens Lehmann Date: Thu, 11 Nov 2010 00:55:02 +0100 Subject: 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 Signed-off-by: Junio C Hamano --- submodule.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'submodule.c') 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); -- cgit v1.2.1