All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johannes Sixt <j.sixt@viscovery.net>
To: Git Mailing List <git@vger.kernel.org>
Subject: [PATCH] rerere forget: deprecate invocation without pathspec
Date: Tue, 01 Mar 2011 14:21:05 +0100	[thread overview]
Message-ID: <4D6CF2C1.9070805@viscovery.net> (raw)

From: Johannes Sixt <j6t@kdbg.org>

rerere forget is a destructive command. When invoked without a path, it
operates on the current directory, potentially deleting many recorded
conflict resolutions.

To make the command safer, a path must be specified as of git 1.8.0. Until
then, give users time to write 'git rerere forget .' if they really mean
the entire current directory.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
---
 I assume that 'rerere forget' is a rarely used command, we can afford
 to change its behavior without a lot of fuzz. Let's not dive into the
 discussion whether it should operate on the current directory or the
 entire repository; rather, require users to be explicit. After all,
 it is destructive!

 BTW, notice that documentation for 'remaining' is missing.

 -- Hannes

 Documentation/git-rerere.txt |    4 ++--
 builtin/rerere.c             |    7 +++++--
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/Documentation/git-rerere.txt b/Documentation/git-rerere.txt
index db99d47..484fdd5 100644
--- a/Documentation/git-rerere.txt
+++ b/Documentation/git-rerere.txt
@@ -7,7 +7,7 @@ git-rerere - Reuse recorded resolution of conflicted merges
 
 SYNOPSIS
 --------
-'git rerere' ['clear'|'forget' [<pathspec>]|'diff'|'status'|'gc']
+'git rerere' ['clear'|'forget' <pathspec>|'diff'|'status'|'gc']
 
 DESCRIPTION
 -----------
@@ -43,7 +43,7 @@ will automatically invoke this command.
 'forget' <pathspec>::
 
 This resets the conflict resolutions which rerere has recorded for the current
-conflict in <pathspec>.  The <pathspec> is optional.
+conflict in <pathspec>.
 
 'diff'::
 
diff --git a/builtin/rerere.c b/builtin/rerere.c
index 67cbfeb..8235885 100644
--- a/builtin/rerere.c
+++ b/builtin/rerere.c
@@ -8,7 +8,7 @@
 #include "xdiff-interface.h"
 
 static const char * const rerere_usage[] = {
-	"git rerere [clear | status | remaining | diff | gc]",
+	"git rerere [clear | forget path... | status | remaining | diff | gc]",
 	NULL,
 };
 
@@ -136,7 +136,10 @@ int cmd_rerere(int argc, const char **argv, const char *prefix)
 		return rerere(flags);
 
 	if (!strcmp(argv[0], "forget")) {
-		const char **pathspec = get_pathspec(prefix, argv + 1);
+		const char **pathspec;
+		if (argc < 2)
+			warning("'git rerere forget' without paths is deprecated");
+		pathspec = get_pathspec(prefix, argv + 1);
 		return rerere_forget(pathspec);
 	}
 
-- 
1.7.4.rc3.76.gfb457d

                 reply	other threads:[~2011-03-01 13:21 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=4D6CF2C1.9070805@viscovery.net \
    --to=j.sixt@viscovery.net \
    --cc=git@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.