@matheusbsbs / matheus-bagliano / commits / 5d2c3b0160
Fork 0

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>

Johannes Sixt committed Mar 1, 2011 at 14:21 UTC 5d2c3b01604a170c52262bf2751c55053d6bd8c1
2 files changed +7 -4
Documentation/git-rerere.txt
+2 -2
@@ -7,7 +7,7 @@ git-rerere - Reuse recorded resolution of conflicted merges
7
8 SYNOPSIS
9 --------
10 -'git rerere' ['clear'|'forget' [<pathspec>]|'diff'|'status'|'gc']
10 +'git rerere' ['clear'|'forget' <pathspec>|'diff'|'status'|'gc']
11
12 DESCRIPTION
13 -----------
@@ -43,7 +43,7 @@ will automatically invoke this command.
43 'forget' <pathspec>::
44
45 This resets the conflict resolutions which rerere has recorded for the current
46 -conflict in <pathspec>. The <pathspec> is optional.
46 +conflict in <pathspec>.
47
48 'diff'::
49
builtin/rerere.c
+5 -2
@@ -8,7 +8,7 @@
8 #include "xdiff-interface.h"
9
10 static const char * const rerere_usage[] = {
11 - "git rerere [clear | status | remaining | diff | gc]",
11 + "git rerere [clear | forget path... | status | remaining | diff | gc]",
12 NULL,
13 };
14
@@ -136,7 +136,10 @@ int cmd_rerere(int argc, const char **argv, const char *prefix)
136 return rerere(flags);
137
138 if (!strcmp(argv[0], "forget")) {
139 - const char **pathspec = get_pathspec(prefix, argv + 1);
139 + const char **pathspec;
140 + if (argc < 2)
141 + warning("'git rerere forget' without paths is deprecated");
142 + pathspec = get_pathspec(prefix, argv + 1);
143 return rerere_forget(pathspec);
144 }
145