summaryrefslogtreecommitdiff
path: root/builtin/clone.c
diff options
context:
space:
mode:
authorLibravatar Mahi Kolla <mkolla2@illinois.edu>2021-08-14 01:09:56 +0000
committerLibravatar Junio C Hamano <gitster@pobox.com>2021-08-30 14:23:17 -0700
commit48072e3d68049a6bbb4f99f3a381e8b7f3647c52 (patch)
tree0bfd64a070366ff64e68875929335c95489e6b4d /builtin/clone.c
parentGit 2.33-rc2 (diff)
downloadtgif-48072e3d68049a6bbb4f99f3a381e8b7f3647c52.tar.xz
clone: set submodule.recurse=true if submodule.stickyRecursiveClone enabled
Based on current experience, when running git clone --recurse-submodules, developers do not expect other commands such as pull or checkout to run recursively into active submodules. However, setting submodule.recurse=true at this step could make for a simpler workflow by eliminating the need for the --recurse-submodules option in subsequent commands. To collect more data on developers' preference in regards to making submodule.recurse=true a default config value in the future, deploy this feature under the opt in submodule.stickyRecursiveClone flag. Signed-off-by: Mahi Kolla <mkolla2@illinois.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/clone.c')
-rw-r--r--builtin/clone.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/builtin/clone.c b/builtin/clone.c
index 66fe66679c..9c0c68a8ef 100644
--- a/builtin/clone.c
+++ b/builtin/clone.c
@@ -1114,6 +1114,7 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
if (option_recurse_submodules.nr > 0) {
struct string_list_item *item;
struct strbuf sb = STRBUF_INIT;
+ int val;
/* remove duplicates */
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));
}
+ if (!git_config_get_bool("submodule.stickyRecursiveClone", &val) &&
+ val)
+ string_list_append(&option_config, "submodule.recurse=true");
+
if (option_required_reference.nr &&
option_optional_reference.nr)
die(_("clone --recursive is not compatible with "