Merge branch 'mk/clone-recurse-submodules'
After "git clone --recurse-submodules", all submodules are cloned but they are not by default recursed into by other commands. With submodule.stickyRecursiveClone configuration set, submodule.recurse configuration is set to true in a repository created by "clone" with "--recurse-submodules" option. * mk/clone-recurse-submodules: clone: set submodule.recurse=true if submodule.stickyRecursiveClone enabledmaint
commit
6d09fc54f6
|
@ -1114,6 +1114,7 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
|
||||||
if (option_recurse_submodules.nr > 0) {
|
if (option_recurse_submodules.nr > 0) {
|
||||||
struct string_list_item *item;
|
struct string_list_item *item;
|
||||||
struct strbuf sb = STRBUF_INIT;
|
struct strbuf sb = STRBUF_INIT;
|
||||||
|
int val;
|
||||||
|
|
||||||
/* remove duplicates */
|
/* remove duplicates */
|
||||||
string_list_sort(&option_recurse_submodules);
|
string_list_sort(&option_recurse_submodules);
|
||||||
|
@ -1130,6 +1131,10 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
|
||||||
strbuf_detach(&sb, NULL));
|
strbuf_detach(&sb, NULL));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!git_config_get_bool("submodule.stickyRecursiveClone", &val) &&
|
||||||
|
val)
|
||||||
|
string_list_append(&option_config, "submodule.recurse=true");
|
||||||
|
|
||||||
if (option_required_reference.nr &&
|
if (option_required_reference.nr &&
|
||||||
option_optional_reference.nr)
|
option_optional_reference.nr)
|
||||||
die(_("clone --recursive is not compatible with "
|
die(_("clone --recursive is not compatible with "
|
||||||
|
|
|
@ -16,6 +16,18 @@ test_expect_success 'setup' '
|
||||||
|
|
||||||
'
|
'
|
||||||
|
|
||||||
|
test_expect_success 'submodule.stickyRecursiveClone flag manipulates submodule.recurse value' '
|
||||||
|
|
||||||
|
test_config_global submodule.stickyRecursiveClone true &&
|
||||||
|
git clone --recurse-submodules parent clone_recurse_true &&
|
||||||
|
test_cmp_config -C clone_recurse_true true submodule.recurse &&
|
||||||
|
|
||||||
|
test_config_global submodule.stickyRecursiveClone false &&
|
||||||
|
git clone --recurse-submodules parent clone_recurse_false &&
|
||||||
|
test_expect_code 1 git -C clone_recurse_false config --get submodule.recurse
|
||||||
|
|
||||||
|
'
|
||||||
|
|
||||||
test_expect_success 'clone -o' '
|
test_expect_success 'clone -o' '
|
||||||
|
|
||||||
git clone -o foo parent clone-o &&
|
git clone -o foo parent clone-o &&
|
||||||
|
|
Loading…
Reference in New Issue