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>
This commit is contained in:
Stefan Beller
2017-05-31 17:30:47 -07:00
committed by Junio C Hamano
parent 1d789d0892
commit 046b48239e
7 changed files with 58 additions and 5 deletions

View File

@ -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);