git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v5] clone: set submodule.recurse=true if user enables feature.experimental flag

From
MGMahi Kolla via GitGitGadget <gitgitgadget@gmail.com>
Date
Aug 12, 2021, 02:46 UTC
Message-ID
<pull.1006.v5.git.1628736366133.gitgitgadget@gmail.com>
In-Reply-To
<pull.1006.v4.git.1628536305810.gitgitgadget@gmail.com>
From: Mahi Kolla <mahikolla@google.com>
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.
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 <mahikolla@google.com>
---
    clone: set submodule.recurse=true if feature.experimental flag 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 feature.experimental 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 mahikolla@google.com
    
    cc: Philippe Blain levraiphilippeblain@gmail.com
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1006%2F24mahik%2Fmaster-v5
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1006/24mahik/master-v5
Pull-Request: https://github.com/gitgitgadget/git/pull/1006
Range-diff vs v4:
 1:  73937d48a53 ! 1:  2c6ffe00736 clone: update submodule.recurse in config when using --recurse-submodule
     @@ Metadata
      Author: Mahi Kolla <mahikolla@google.com>
      
       ## Commit message ##
     -    clone: update submodule.recurse in config when using --recurse-submodule
     +    clone: set submodule.recurse=true if user enables feature.experimental flag
      
     -    When running 'git clone --recurse-submodules', developers might expect various other commands such as 'pull' and 'checkout' to also run recursively into submodules. Set 'submodule.recurse' to true when 'git clone' is run with '--recurse-submodules'.
     +    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.
      
     -    Since V1: Updated test and 'git clone' man page. Also updated commit message.
     +    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 <mahikolla@google.com>
      
     - ## Documentation/git-clone.txt ##
     -@@ Documentation/git-clone.txt: branch of some repository for search indexing.
     - 	This option can be given multiple times for pathspecs consisting
     - 	of multiple entries.  The resulting clone has `submodule.active` set to
     - 	the provided pathspec, or "." (meaning all submodules) if no
     --	pathspec is provided.
     -+	pathspec is provided. In addition, `submodule.recurse` is set to true.
     - +
     - Submodules are initialized and cloned using their default settings. This is
     - equivalent to running
     -
       ## 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;
     + 
     + 	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));
       		}
       
     -+		string_list_append(&option_config, "submodule.recurse=true");
     ++		if(!git_config_get_bool("feature.experimental", &experimental_flag) &&
     ++		    experimental_flag) {
     ++		    string_list_append(&option_config, "submodule.recurse=true");
     ++		}
     ++
       		if (option_required_reference.nr &&
       		    option_optional_reference.nr)
       			die(_("clone --recursive is not compatible with "
     @@ t/t5606-clone-options.sh: test_expect_success 'setup' '
       
       '
       
     -+test_expect_success 'clone --recurse-submodules sets submodule.recurse=true' '
     ++test_expect_success 'feature.experimental flag manipulates submodule.recurse value' '
     ++
     ++	test_config_global feature.experimental true &&
     ++	git clone --recurse-submodules parent clone_recurse_true &&
     ++	test_cmp_config -C clone_recurse_true true submodule.recurse &&
      +
     -+	git clone --recurse-submodules parent clone-rec-submodule &&
     -+	test_cmp_config -C clone-rec-submodule true submodule.recurse
     ++	test_config_global feature.experimental 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..24f242b4a60 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 experimental_flag;
 
 	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("feature.experimental", &experimental_flag) &&
+		    experimental_flag) {
+		    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..f20cdfa6fca 100755
--- a/t/t5606-clone-options.sh
+++ b/t/t5606-clone-options.sh
@@ -16,6 +16,18 @@ test_expect_success 'setup' '
 
 '
 
+test_expect_success 'feature.experimental flag manipulates submodule.recurse value' '
+
+	test_config_global feature.experimental 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 &&
+	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
Previous: Junio C HamanoNext: Junio C Hamano
Message 24 of 46 in “clone: update submodule.recurse in config when using --recurse-submodule”
  1. 0/2 clone: update submodule.recurse in config when using --recurse-submoduleMahi Kolla via GitGitGadget, Aug 2, 2021
  2. 1/2 clone: update submodule.recurse in config when using --recurse-submoduleMahi Kolla via GitGitGadget, Aug 2, 2021
  3. 2/2 clone: update submodule.recurse in config when using --recurse-submoduleMahi Kolla via GitGitGadget, Aug 2, 2021
  4. 0/3 clone: update submodule.recurse in config when using --recurse-submoduleMahi Kolla via GitGitGadget, Aug 2, 2021
  5. 1/3 clone: update submodule.recurse in config when using --recurse-submoduleMahi Kolla via GitGitGadget, Aug 2, 2021
  6. 2/3 clone: update submodule.recurse in config when using --recurse-submoduleMahi Kolla via GitGitGadget, Aug 2, 2021
  7. 3/3 clone test: update whitespace according to style guideMahi Kolla via GitGitGadget, Aug 2, 2021
  8. 0/4 clone: update submodule.recurse in config when using --recurse-submoduleMahi Kolla via GitGitGadget, Aug 2, 2021
  9. 1/4 clone: update submodule.recurse in config when using --recurse-submoduleMahi Kolla via GitGitGadget, Aug 2, 2021
  10. Philippe BlainAug 3, 2021
  11. Mahi KollaAug 7, 2021
  12. 2/4 clone: update submodule.recurse in config when using --recurse-submoduleMahi Kolla via GitGitGadget, Aug 2, 2021
  13. 3/4 clone test: update whitespace according to style guideMahi Kolla via GitGitGadget, Aug 2, 2021
  14. 4/4 clone: update whitespace according to style guideMahi Kolla via GitGitGadget, Aug 2, 2021
  15. Philippe BlainAug 3, 2021
  16. Junio C HamanoAug 3, 2021
  17. clone: update submodule.recurse in config when using --recurse-submoduleMahi Kolla via GitGitGadget, Aug 9, 2021
  18. Junio C HamanoAug 9, 2021
  19. Mahi KollaAug 10, 2021
  20. Junio C HamanoAug 10, 2021
  21. Philippe BlainAug 10, 2021
  22. Mahi KollaAug 10, 2021
  23. Junio C HamanoAug 11, 2021
  24. clone: set submodule.recurse=true if user enables feature.experimental flagMahi Kolla via GitGitGadget, Aug 12, 2021
  25. Junio C HamanoAug 12, 2021
  26. Emily ShafferAug 12, 2021
  27. Philippe BlainAug 13, 2021
  28. Mahi KollaAug 13, 2021
  29. Junio C HamanoAug 13, 2021
  30. Junio C HamanoAug 13, 2021
  31. Junio C HamanoAug 13, 2021
  32. Emily ShafferAug 13, 2021
  33. Junio C HamanoAug 13, 2021
  34. Emily ShafferAug 13, 2021
  35. Mahi KollaAug 13, 2021
  36. Junio C HamanoAug 13, 2021
  37. Felipe ContrerasAug 13, 2021
  38. clone: set submodule.recurse=true if submodule.stickyRecursiveClone enabledMahi Kolla via GitGitGadget, Aug 14, 2021
  39. Junio C HamanoAug 14, 2021
  40. Emily ShafferAug 17, 2021
  41. Junio C HamanoAug 18, 2021
  42. fixup! clone: set submodule.recurse=true if submodule.stickyRecursiveClone enabledJunio C Hamano, Aug 18, 2021
  43. Emily ShafferAug 19, 2021
  44. Emily ShafferAug 30, 2021
  45. Junio C HamanoAug 30, 2021
  46. Philippe BlainAug 18, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.