git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jens Lehmann <Jens.Lehmann@web.de>
To: Git Mailing List <git@vger.kernel.org>
Cc: Junio C Hamano <gitster@pobox.com>,
	Chris Packham <judge.packham@gmail.com>
Subject: [RFC PATCH] clone: Deprecate the --recursive option in favor of --recurse-submodules
Date: Wed, 03 Nov 2010 19:41:59 +0100	[thread overview]
Message-ID: <4CD1ACF7.6040108@web.de> (raw)

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@web.de>
---


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

             reply	other threads:[~2010-11-03 18:42 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-03 18:41 Jens Lehmann [this message]
2010-11-03 22:13 ` [RFC PATCH] clone: Deprecate the --recursive option in favor of --recurse-submodules Jakub Narebski
2010-11-03 22:24   ` Sverre Rabbelier
2010-11-03 22:36 ` Junio C Hamano
2010-11-04 20:27   ` [PATCH] clone: Add the --recurse-submodules option as alias for --recursive Jens Lehmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4CD1ACF7.6040108@web.de \
    --to=jens.lehmann@web.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=judge.packham@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).