summaryrefslogtreecommitdiff
path: root/submodule.c
diff options
context:
space:
mode:
authorStefan Beller <sbeller@google.com>2017-06-01 00:30:47 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-06-01 01:36:36 (GMT)
commit046b48239eca34425909330e59da57f5fd421bdc (patch)
tree0b9e24fe8237837f2a3934ea36d9376df4616d10 /submodule.c
parent1d789d089280539ca39b83aabb67860929d39b75 (diff)
downloadgit-046b48239eca34425909330e59da57f5fd421bdc.zip
git-046b48239eca34425909330e59da57f5fd421bdc.tar.gz
git-046b48239eca34425909330e59da57f5fd421bdc.tar.bz2
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.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/submodule.c b/submodule.c
index 78cccb7..2b157dc 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,