diff options
author | Stefan Beller <sbeller@google.com> | 2017-06-01 02:30:47 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-06-01 03:36:36 +0200 |
commit | 046b48239eca34425909330e59da57f5fd421bdc (patch) | |
tree | 0b9e24fe8237837f2a3934ea36d9376df4616d10 /submodule.c | |
parent | submodule loading: separate code path for .gitmodules and config overlay (diff) | |
download | git-046b48239eca34425909330e59da57f5fd421bdc.tar.xz git-046b48239eca34425909330e59da57f5fd421bdc.zip |
Introduce 'submodule.recurse' option for worktree manipulators
Any command that understands '--recurse-submodules' can have its
default changed to true, by setting the new 'submodule.recurse'
option.
This patch includes read-tree/checkout/reset for working tree
manipulating commands. Later patches will cover other commands.
Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'submodule.c')
-rw-r--r-- | submodule.c | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/submodule.c b/submodule.c index 78cccb7563..2b157dc995 100644 --- a/submodule.c +++ b/submodule.c @@ -16,6 +16,7 @@ #include "quote.h" #include "remote.h" #include "worktree.h" +#include "parse-options.h" static int config_fetch_recurse_submodules = RECURSE_SUBMODULES_ON_DEMAND; static int config_update_recurse_submodules = RECURSE_SUBMODULES_OFF; @@ -170,10 +171,28 @@ static int git_modules_config(const char *var, const char *value, void *cb) return 0; } -/* Loads all submodule settings from the config */ +/* Loads all submodule settings from the config. */ int submodule_config(const char *var, const char *value, void *cb) { - return git_modules_config(var, value, cb); + if (!strcmp(var, "submodule.recurse")) { + int v = git_config_bool(var, value) ? + RECURSE_SUBMODULES_ON : RECURSE_SUBMODULES_OFF; + config_update_recurse_submodules = v; + return 0; + } else { + return git_modules_config(var, value, cb); + } +} + +/* Cheap function that only determines if we're interested in submodules at all */ +int git_default_submodule_config(const char *var, const char *value, void *cb) +{ + if (!strcmp(var, "submodule.recurse")) { + int v = git_config_bool(var, value) ? + RECURSE_SUBMODULES_ON : RECURSE_SUBMODULES_OFF; + config_update_recurse_submodules = v; + } + return 0; } int option_parse_recurse_submodules_worktree_updater(const struct option *opt, |