1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-27 20:26:08 +02:00

rerere forget: deprecate invocation without pathspec

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>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Johannes Sixt 2011-03-01 14:21:05 +01:00 committed by Junio C Hamano
parent f70f736bcb
commit 5d2c3b0160
2 changed files with 7 additions and 4 deletions

View File

@ -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'::

View File

@ -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);
}