From d7a3803f9e83242adac0f02af843ef0520c71f0a Mon Sep 17 00:00:00 2001 From: Stefan Beller Date: Fri, 26 May 2017 12:10:12 -0700 Subject: reset/checkout/read-tree: unify config callback for submodule recursion The callback function is essentially duplicated 3 times. Remove all of them and offer a new callback function, that lives in submodule.c By putting the callback function there, we no longer need the function 'set_config_update_recurse_submodules', nor duplicate the global variable in each builtin as well as submodule.c In the three builtins we have different 2 ways how to load the .gitmodules and config file, which are slightly different. git-checkout has to load the submodule config all the time due to 23b4c7bcc5 (checkout: Use submodule.*.ignore settings from .git/config and .gitmodules, 2010-08-28) git-reset and git-read-tree do not respect these diff settings, so loading the submodule configuration is optional. Also put that into submodule.c for code deduplication. Signed-off-by: Stefan Beller Signed-off-by: Junio C Hamano --- submodule.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'submodule.h') diff --git a/submodule.h b/submodule.h index 1277480add..b13f120f76 100644 --- a/submodule.h +++ b/submodule.h @@ -39,6 +39,11 @@ extern void stage_updated_gitmodules(void); extern void set_diffopt_flags_from_submodule_config(struct diff_options *, const char *path); extern int submodule_config(const char *var, const char *value, void *cb); + +struct option; +int option_parse_recurse_submodules_worktree_updater(const struct option *opt, + const char *arg, int unset); +void load_submodule_cache(void); extern void gitmodules_config(void); extern void gitmodules_config_sha1(const unsigned char *commit_sha1); extern int is_submodule_initialized(const char *path); @@ -65,7 +70,6 @@ extern void show_submodule_inline_diff(FILE *f, const char *path, const char *del, const char *add, const char *reset, const struct diff_options *opt); extern void set_config_fetch_recurse_submodules(int value); -extern void set_config_update_recurse_submodules(int value); /* Check if we want to update any submodule.*/ extern int should_update_submodules(void); /* -- cgit v1.2.3 From 046b48239eca34425909330e59da57f5fd421bdc Mon Sep 17 00:00:00 2001 From: Stefan Beller Date: Wed, 31 May 2017 17:30:47 -0700 Subject: 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 Signed-off-by: Junio C Hamano --- submodule.h | 1 + 1 file changed, 1 insertion(+) (limited to 'submodule.h') diff --git a/submodule.h b/submodule.h index b13f120f76..d920ca1d5a 100644 --- a/submodule.h +++ b/submodule.h @@ -39,6 +39,7 @@ extern void stage_updated_gitmodules(void); extern void set_diffopt_flags_from_submodule_config(struct diff_options *, const char *path); extern int submodule_config(const char *var, const char *value, void *cb); +extern int git_default_submodule_config(const char *var, const char *value, void *cb); struct option; int option_parse_recurse_submodules_worktree_updater(const struct option *opt, -- cgit v1.2.3