Skip to contentSkip to conversation

Documentation/git-clone: improve description for submodule recursing

PATCH In review Stefan Beller 2 participants 2 messages Dec 5, 2017 Documentation

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Documentation/git-clone: improve description for submodule recursing

There have been a few complaints on the mailing list that git-clone doesn't respect the submodule.recurse setting, which every other command (that potentially knows how to deal with submodules) respects. In case of clone this is not beneficial to respect as the user may not want to obtain all submodules (assuming a pathspec of '.').

Improve the documentation such that the pathspec is mentioned in the synopsis to alleviate the confusion around the submodule recursion flag in git-clone.

While at it clarify that the option can be given multiple times for complex\
pathspecs.

---
 Documentation/git-clone.txt | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)
Documentation/git-clone.txt +11 -8
index 83c8e9b394..42ca7b5095 100644
@@ -14,7 +14,7 @@ SYNOPSIS
 	  [-o <name>] [-b <name>] [-u <upload-pack>] [--reference <repository>]
 	  [--dissociate] [--separate-git-dir <git dir>]
 	  [--depth <depth>] [--[no-]single-branch] [--no-tags]
-	  [--recurse-submodules] [--[no-]shallow-submodules]
+	  [--recurse-submodules[=<pathspec>]] [--[no-]shallow-submodules]
 	  [--jobs <n>] [--] <repository> [<directory>]
 
 DESCRIPTION
@@ -231,14 +231,17 @@ branch of some repository for search indexing.
 	After the clone is created, initialize and clone submodules
 	within based on the provided pathspec.  If no pathspec is
 	provided, all submodules are initialized and cloned.
-	Submodules are initialized and cloned using their default
-	settings.  The resulting clone has `submodule.active` set to
+	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.  This is equivalent to running
-	`git submodule update --init --recursive` immediately after
-	the clone is finished. This option is ignored if the cloned
-	repository does not have a worktree/checkout (i.e. if any of
-	`--no-checkout`/`-n`, `--bare`, or `--mirror` is given)
+	pathspec is provided.
++
+Submodules are initialized and cloned using their default settings. This is
+equivalent to running
+`git submodule update --init --recursive <pathspec>` immediately after
+the clone is finished. This option is ignored if the cloned repository does
+not have a worktree/checkout (i.e. if any of `--no-checkout`/`-n`, `--bare`,
+or `--mirror` is given)
 
 --[no-]shallow-submodules::
 	All submodules which are cloned will be shallow with a depth of 1.
Signature · 1 line
2.15.0.531.g2ccb3012c9-goog
#1 lore raw
Quoted 6 lines · Stefan Beller

There have been a few complaints on the mailing list that git-clone doesn't respect the submodule.recurse setting, which every other command (that potentially knows how to deal with submodules) respects. In case of clone this is not beneficial to respect as the user may not want to obtain all submodules (assuming a pathspec of '.').

Quoted 6 lines

Improve the documentation such that the pathspec is mentioned in the synopsis to alleviate the confusion around the submodule recursion flag in git-clone.

While at it clarify that the option can be given multiple times for complex\
pathspecs.

Well written (modulo the backslash there, which I can easily remove while queuing).

Quoted 44 lines
---
 Documentation/git-clone.txt | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)
Documentation/git-clone.txt +11 -8
index 83c8e9b394..42ca7b5095 100644
@@ -14,7 +14,7 @@ SYNOPSIS
 	  [-o <name>] [-b <name>] [-u <upload-pack>] [--reference <repository>]
 	  [--dissociate] [--separate-git-dir <git dir>]
 	  [--depth <depth>] [--[no-]single-branch] [--no-tags]
-	  [--recurse-submodules] [--[no-]shallow-submodules]
+	  [--recurse-submodules[=<pathspec>]] [--[no-]shallow-submodules]
 	  [--jobs <n>] [--] <repository> [<directory>]
 
 DESCRIPTION
@@ -231,14 +231,17 @@ branch of some repository for search indexing.
 	After the clone is created, initialize and clone submodules
 	within based on the provided pathspec.  If no pathspec is
 	provided, all submodules are initialized and cloned.
-	Submodules are initialized and cloned using their default
-	settings.  The resulting clone has `submodule.active` set to
+	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.  This is equivalent to running
-	`git submodule update --init --recursive` immediately after
-	the clone is finished. This option is ignored if the cloned
-	repository does not have a worktree/checkout (i.e. if any of
-	`--no-checkout`/`-n`, `--bare`, or `--mirror` is given)
+	pathspec is provided.
++
+Submodules are initialized and cloned using their default settings. This is
+equivalent to running
+`git submodule update --init --recursive <pathspec>` immediately after
+the clone is finished. This option is ignored if the cloned repository does
+not have a worktree/checkout (i.e. if any of `--no-checkout`/`-n`, `--bare`,
+or `--mirror` is given)
 
 --[no-]shallow-submodules::
 	All submodules which are cloned will be shallow with a depth of 1.