diff options
| author | Stefan Beller <sbeller@google.com> | 2017-05-31 17:30:47 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2017-06-01 10:36:36 +0900 |
| commit | 046b48239eca34425909330e59da57f5fd421bdc (patch) | |
| tree | 0b9e24fe8237837f2a3934ea36d9376df4616d10 /builtin | |
| parent | 1d789d089280539ca39b83aabb67860929d39b75 (diff) | |
| download | git-046b48239eca34425909330e59da57f5fd421bdc.tar.xz | |
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 'builtin')
| -rw-r--r-- | builtin/checkout.c | 2 | ||||
| -rw-r--r-- | builtin/read-tree.c | 10 | ||||
| -rw-r--r-- | builtin/reset.c | 10 |
3 files changed, 19 insertions, 3 deletions
diff --git a/builtin/checkout.c b/builtin/checkout.c index 56ea723b75..e289b7d477 100644 --- a/builtin/checkout.c +++ b/builtin/checkout.c @@ -855,7 +855,7 @@ static int git_checkout_config(const char *var, const char *value, void *cb) } if (starts_with(var, "submodule.")) - return parse_submodule_config_option(var, value); + return submodule_config(var, value, NULL); return git_xmerge_config(var, value, NULL); } diff --git a/builtin/read-tree.c b/builtin/read-tree.c index 8a889ef4c3..7fd55140db 100644 --- a/builtin/read-tree.c +++ b/builtin/read-tree.c @@ -98,6 +98,14 @@ static int debug_merge(const struct cache_entry * const *stages, return 0; } +static int git_read_tree_config(const char *var, const char *value, void *cb) +{ + if (!strcmp(var, "submodule.recurse")) + return git_default_submodule_config(var, value, cb); + + return git_default_config(var, value, cb); +} + static struct lock_file lock_file; int cmd_read_tree(int argc, const char **argv, const char *unused_prefix) @@ -150,7 +158,7 @@ int cmd_read_tree(int argc, const char **argv, const char *unused_prefix) opts.src_index = &the_index; opts.dst_index = &the_index; - git_config(git_default_config, NULL); + git_config(git_read_tree_config, NULL); argc = parse_options(argc, argv, unused_prefix, read_tree_options, read_tree_usage, 0); diff --git a/builtin/reset.c b/builtin/reset.c index 6f89dc5494..585cfe0745 100644 --- a/builtin/reset.c +++ b/builtin/reset.c @@ -266,6 +266,14 @@ static int reset_refs(const char *rev, const struct object_id *oid) return update_ref_status; } +static int git_reset_config(const char *var, const char *value, void *cb) +{ + if (!strcmp(var, "submodule.recurse")) + return git_default_submodule_config(var, value, cb); + + return git_default_config(var, value, cb); +} + int cmd_reset(int argc, const char **argv, const char *prefix) { int reset_type = NONE, update_ref_status = 0, quiet = 0; @@ -294,7 +302,7 @@ int cmd_reset(int argc, const char **argv, const char *prefix) OPT_END() }; - git_config(git_default_config, NULL); + git_config(git_reset_config, NULL); argc = parse_options(argc, argv, prefix, options, git_reset_usage, PARSE_OPT_KEEP_DASHDASH); |
