From: Mahi Kolla <mahikolla@google.com>
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'.
Since V1: Updated test and 'git clone' man page. Also updated commit message.
Signed-off-by: Mahi Kolla <mahikolla@google.com>
---
clone: update submodule.recurse in config when using --recurse-submodule
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'.
Since V1: Updated test and 'git clone' man page. Also updated commit
message.
Signed-off-by: Mahi Kolla mahikolla@google.com
cc: Philippe Blain levraiphilippeblain@gmail.comPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-1006%2F24mahik%2Fmaster-v4
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1006/24mahik/master-v4
Pull-Request: https://github.com/gitgitgadget/git/pull/1006
Range-diff vs v3:
1: fea3d6d72b6 ! 1: 73937d48a53 clone: update submodule.recurse in config when using --recurse-submodule
@@ Metadata
## Commit message ##
clone: update submodule.recurse in config when using --recurse-submodule
- When running 'git clone --recurse-submodules', developers expect various other commands such as 'pull' and 'checkout' to also run recursively into submodules.The submitted code updates the 'submodule.recurse' config value to true when 'git clone' is run with the '--recurse-submodules' option.
+ 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'.
+
+ Since V1: Updated test and 'git clone' man page. 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)
strbuf_detach(&sb, NULL));
}
-+ string_list_append(&option_config, "submodule.recurse=true");
++ 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' '
+
-+ git clone --recurse-submodules parent clone-rec-submodule &&
-+ test_config_global submodule.recurse true
++ git clone --recurse-submodules parent clone-rec-submodule &&
++ test_cmp_config -C clone-rec-submodule true submodule.recurse
+
+'
+
2: dd13a65ef0f < -: ----------- clone: update submodule.recurse in config when using --recurse-submodule
3: 020eaa2c819 < -: ----------- clone test: update whitespace according to style guide
4: f3ddb344b49 < -: ----------- clone: update whitespace according to style guide Documentation/git-clone.txt | 2 +-
builtin/clone.c | 1 +
t/t5606-clone-options.sh | 7 +++++++
3 files changed, 9 insertions(+), 1 deletion(-)