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 /builtin | |
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 'builtin')
-rw-r--r-- | builtin/fetch.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/builtin/fetch.c b/builtin/fetch.c index cbbde2d0ee..75032a5076 100644 --- a/builtin/fetch.c +++ b/builtin/fetch.c @@ -28,8 +28,14 @@ enum { TAGS_SET = 2 }; +enum { + RECURSE_SUBMODULES_OFF = 0, + RECURSE_SUBMODULES_DEFAULT = 1, + RECURSE_SUBMODULES_ON = 2 +}; + static int all, append, dry_run, force, keep, multiple, prune, update_head_ok, verbosity; -static int progress, recurse_submodules; +static int progress, recurse_submodules = RECURSE_SUBMODULES_DEFAULT; static int tags = TAGS_DEFAULT; static const char *depth; static const char *upload_pack; @@ -55,8 +61,9 @@ static struct option builtin_fetch_options[] = { "do not fetch all tags (--no-tags)", TAGS_UNSET), OPT_BOOLEAN('p', "prune", &prune, "prune tracking branches no longer on remote"), - OPT_BOOLEAN(0, "recurse-submodules", &recurse_submodules, - "control recursive fetching of submodules"), + OPT_SET_INT(0, "recurse-submodules", &recurse_submodules, + "control recursive fetching of submodules", + RECURSE_SUBMODULES_ON), OPT_BOOLEAN(0, "dry-run", &dry_run, "dry run"), OPT_BOOLEAN('k', "keep", &keep, "keep downloaded pack"), @@ -795,7 +802,7 @@ static void add_options_to_argv(int *argc, const char **argv) argv[(*argc)++] = "--force"; if (keep) argv[(*argc)++] = "--keep"; - if (recurse_submodules) + if (recurse_submodules == RECURSE_SUBMODULES_ON) argv[(*argc)++] = "--recurse-submodules"; if (verbosity >= 2) argv[(*argc)++] = "-v"; @@ -933,14 +940,18 @@ int cmd_fetch(int argc, const char **argv, const char *prefix) } } - if (!result && recurse_submodules) { + if (!result && (recurse_submodules != RECURSE_SUBMODULES_OFF)) { const char *options[10]; int num_options = 0; + /* Set recursion as default when we already are recursing */ + if (submodule_prefix[0]) + set_config_fetch_recurse_submodules(1); gitmodules_config(); git_config(submodule_config, NULL); add_options_to_argv(&num_options, options); result = fetch_populated_submodules(num_options, options, submodule_prefix, + recurse_submodules == RECURSE_SUBMODULES_ON, verbosity < 0); } |