diff options
author | Jens Lehmann <Jens.Lehmann@web.de> | 2010-11-11 00:55:41 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2010-11-12 15:06:03 -0800 |
commit | c1a3c3640deb8bd6929026a55b18feb1dda74e77 (patch) | |
tree | 8dc29f8d815f7dff07895414f4cb5bd21857bb92 /submodule.c | |
parent | be254a0ea99b441a6c514cb8b25cd72357383700 (diff) | |
download | git-c1a3c3640deb8bd6929026a55b18feb1dda74e77.tar.gz |
Submodules: Add the "fetchRecurseSubmodules" config option
The new boolean "fetchRecurseSubmodules" config option controls the
behavior for "git fetch" and "git pull". It specifies if these commands
should recurse into submodules and fetch new commits there too and can be
set separately for each submodule.
In the .gitmodules file "submodule.<name>.fetchRecurseSubmodules" entries
are read before looking for them in .git/config. Thus settings found in
.git/config will override those from .gitmodules, thereby allowing the
user to ignore settings given by the remote side while also letting
upstream set reasonable defaults for those users who don't have special
needs.
This configuration can be overridden by the command line option
"--[no-]recurse-submodules" of "git fetch" and "git pull".
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 | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/submodule.c b/submodule.c index 01d75f528b..4e62900af1 100644 --- a/submodule.c +++ b/submodule.c @@ -10,6 +10,7 @@ #include "string-list.h" struct string_list config_name_for_path; +struct string_list config_fetch_recurse_submodules_for_name; struct string_list config_ignore_for_name; static int config_fetch_recurse_submodules; @@ -105,6 +106,14 @@ int parse_submodule_config_option(const char *var, const char *value) config = string_list_append(&config_name_for_path, xstrdup(value)); config->util = strbuf_detach(&submodname, NULL); strbuf_release(&submodname); + } else if ((len > 23) && !strcmp(var + len - 23, ".fetchrecursesubmodules")) { + strbuf_add(&submodname, var, len - 23); + config = unsorted_string_list_lookup(&config_fetch_recurse_submodules_for_name, submodname.buf); + if (!config) + config = string_list_append(&config_fetch_recurse_submodules_for_name, + strbuf_detach(&submodname, NULL)); + config->util = git_config_bool(var, value) ? (void *)1 : NULL; + strbuf_release(&submodname); } else if ((len > 7) && !strcmp(var + len - 7, ".ignore")) { if (strcmp(value, "untracked") && strcmp(value, "dirty") && strcmp(value, "all") && strcmp(value, "none")) { @@ -283,8 +292,15 @@ int fetch_populated_submodules(int num_options, const char **options, name = name_for_path->util; if (!ignore_config) { - if (!config_fetch_recurse_submodules) - continue; + struct string_list_item *fetch_recurse_submodules_option; + fetch_recurse_submodules_option = unsorted_string_list_lookup(&config_fetch_recurse_submodules_for_name, name); + if (fetch_recurse_submodules_option) { + if (!fetch_recurse_submodules_option->util) + continue; + } else { + if (!config_fetch_recurse_submodules) + continue; + } } strbuf_addf(&submodule_path, "%s/%s", work_tree, ce->name); |