[PATCH v6] clone: set submodule.recurse=true if submodule.stickyRecursiveClone enabled
From: Mahi Kolla via GitGitGadget <hidden>
Date: 2021-08-14 01:10:02
Subsystem:
the rest · Maintainer:
Linus Torvalds
From: Mahi Kolla <redacted>
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 <redacted>
---
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' behavior and
preferences when making submodule.recurse=true a default, deploy this
feature under the opt in submodule.stickyRecursiveClone flag.
Signed-off-by: Mahi Kolla mkolla2@illinois.edu
Since V1: Made this an opt in feature under a custom
submodule.stickyRecursiveClone flag as opposed to feature.experimental.
Updated tests to reflect this design change. Also updated commit
message. Additionally, I will be contributing from my personal email
going forward as opposed to my @google email.
cc: Philippe Blain levraiphilippeblain@gmail.com
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1006%2F24mahik%2Fmaster-v6
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1006/24mahik/master-v6
Pull-Request: https://github.com/gitgitgadget/git/pull/1006
Range-diff vs v5:
1: 2c6ffe00736 ! 1: e668fa403cf clone: set submodule.recurse=true if user enables feature.experimental flag
@@
## Metadata ##
-Author: Mahi Kolla [off-list ref]
+Author: Mahi Kolla [off-list ref]
## Commit message ##
- clone: set submodule.recurse=true if user enables feature.experimental flag
+ clone: set submodule.recurse=true if submodule.stickyRecursiveClone enabled
- Currently, 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' to true at this step could make for a simpler workflow by eliminating 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 feature.experimental flag.
+ 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.
- Since V1: Made this an opt in feature under the experimental flag. Updated tests to reflect this design change. Also updated commit message.
-
- Signed-off-by: Mahi Kolla [off-list ref]
+ Signed-off-by: Mahi Kolla [off-list ref]
## builtin/clone.c ##
@@ builtin/clone.c: int cmd_clone(int argc, const char **argv, const char *prefix)
struct remote *remote;
int err = 0, complete_refs_before_fetch = 1;
int submodule_progress;
-+ int experimental_flag;
++ int sticky_recursive_clone;
struct transport_ls_refs_options transport_ls_refs_options =
TRANSPORT_LS_REFS_OPTIONS_INIT;
@@ builtin/clone.c: int cmd_clone(int argc, const char **argv, const char *prefix)
strbuf_detach(&sb, NULL));
}
-+ if(!git_config_get_bool("feature.experimental", &experimental_flag) &&
-+ experimental_flag) {
++ if (!git_config_get_bool("submodule.stickyRecursiveClone", &sticky_recursive_clone)
++ && sticky_recursive_clone) {
+ string_list_append(&option_config, "submodule.recurse=true");
+ }
+
@@ t/t5606-clone-options.sh: test_expect_success 'setup' '
'
-+test_expect_success 'feature.experimental flag manipulates submodule.recurse value' '
++test_expect_success 'submodule.stickyRecursiveClone flag manipulates submodule.recurse value' '
+
-+ test_config_global feature.experimental true &&
++ 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 feature.experimental false &&
++ 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
+
builtin/clone.c | 6 ++++++
t/t5606-clone-options.sh | 12 ++++++++++++
2 files changed, 18 insertions(+)
diff --git a/builtin/clone.c b/builtin/clone.c
index 66fe66679c8..a08d9012243 100644
--- a/builtin/clone.c
+++ b/builtin/clone.c@@ -986,6 +986,7 @@ int cmd_clone(int argc, const char **argv, const char *prefix) struct remote *remote; int err = 0, complete_refs_before_fetch = 1; int submodule_progress; + int sticky_recursive_clone; struct transport_ls_refs_options transport_ls_refs_options = TRANSPORT_LS_REFS_OPTIONS_INIT;
@@ -1130,6 +1131,11 @@ int cmd_clone(int argc, const char **argv, const char *prefix) strbuf_detach(&sb, NULL)); } + if (!git_config_get_bool("submodule.stickyRecursiveClone", &sticky_recursive_clone) + && sticky_recursive_clone) { + string_list_append(&option_config, "submodule.recurse=true"); + } + if (option_required_reference.nr && option_optional_reference.nr) die(_("clone --recursive is not compatible with "
diff --git a/t/t5606-clone-options.sh b/t/t5606-clone-options.sh
index 3a595c0f82c..d822153e4d2 100755
--- a/t/t5606-clone-options.sh
+++ b/t/t5606-clone-options.sh@@ -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' ' git clone -o foo parent clone-o &&
base-commit: 66262451ec94d30ac4b80eb3123549cf7a788afd -- gitgitgadget