[RFC PATCH] clone: Deprecate the --recursive option in favor of --recurse-submodules

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Since 1.6.5 "git clone" honors the --recursive option to recursively check
out submodules too. As this option can easily be misinterpreted when it is
added to other commands like "git grep", add the new --recurse-submodules
option to avoid confusing it with other types of recursion.

Signed-off-by: Jens Lehmann <Jens.Lehmann@xxxxxx>
---


At the GitTogether some of us were talking about a sane option name for
recursing submodules which should then be used consistently by all
commands (maybe with the exception of "git submodule", as --recursive
there has a pretty obvious meaning). For my first recursion patches a
few months ago I started with --recurse-submodules but then I noticed
that "git clone" already used "--recursive" for the same purpose, and
for consistency reasons I switched to using that too. But especially
when looking at recursive grep it is really easy to misinterpret
--recursive, so the idea came up to use --recurse-submodules everywhere.

Opinions?


 Documentation/git-clone.txt |    5 +++--
 builtin/clone.c             |   10 ++++++++--
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/Documentation/git-clone.txt b/Documentation/git-clone.txt
index ab72933..1768cef 100644
--- a/Documentation/git-clone.txt
+++ b/Documentation/git-clone.txt
@@ -12,7 +12,7 @@ SYNOPSIS
 'git clone' [--template=<template_directory>]
 	  [-l] [-s] [--no-hardlinks] [-q] [-n] [--bare] [--mirror]
 	  [-o <name>] [-b <name>] [-u <upload-pack>] [--reference <repository>]
-	  [--depth <depth>] [--recursive] [--] <repository> [<directory>]
+	  [--depth <depth>] [--recurse-submodules] [--] <repository> [<directory>]

 DESCRIPTION
 -----------
@@ -166,13 +166,14 @@ objects from the source repository into a pack in the cloned repository.
 	with a long history, and would want to send in fixes
 	as patches.

---recursive::
+--recurse-submodules::
 	After the clone is created, initialize all submodules within,
 	using their default settings. 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)
+	This option replaces the now deprecated `--recursive`.

 <repository>::
 	The (possibly remote) repository to clone from.  See the
diff --git a/builtin/clone.c b/builtin/clone.c
index 19ed640..91e7fab 100644
--- a/builtin/clone.c
+++ b/builtin/clone.c
@@ -43,7 +43,7 @@ static char *option_template, *option_reference, *option_depth;
 static char *option_origin = NULL;
 static char *option_branch = NULL;
 static char *option_upload_pack = "git-upload-pack";
-static int option_verbosity;
+static int option_verbosity, option_recurse_submodules;
 static int option_progress;

 static struct option builtin_clone_options[] = {
@@ -65,6 +65,8 @@ static struct option builtin_clone_options[] = {
 	OPT_BOOLEAN('s', "shared", &option_shared,
 		    "setup as shared repository"),
 	OPT_BOOLEAN(0, "recursive", &option_recursive,
+		    "initialize submodules in the clone (deprecated)"),
+	OPT_BOOLEAN(0, "recurse_submodules", &option_recurse_submodules,
 		    "initialize submodules in the clone"),
 	OPT_STRING(0, "template", &option_template, "path",
 		   "path the template repository"),
@@ -659,7 +661,11 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
 				sha1_to_hex(our_head_points_at->old_sha1), "1",
 				NULL);

-		if (!err && option_recursive)
+		if (option_recursive) {
+			warning("--recursive is deprecated; use --recurse-submodules instead.");
+			option_recurse_submodules = 1;
+		}
+		if (!err && option_recurse_submodules)
 			err = run_command_v_opt(argv_submodule, RUN_GIT_CMD);
 	}

-- 
1.7.3.2.213.g5fe186
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]