rerere: convert to use parse_pathspec

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Nguyễn Thái Ngọc Duy committed Jul 14, 2013 at 15:35 UTC 01a10b0af9f84069f7c96cb4c94e1417cb7139c1
3 files changed +13 -8
builtin/rerere.c
+5 -3
@@ -6,6 +6,7 @@
6 #include "rerere.h"
7 #include "xdiff/xdiff.h"
8 #include "xdiff-interface.h"
9 +#include "pathspec.h"
10
11 static const char * const rerere_usage[] = {
12 N_("git rerere [clear | forget path... | status | remaining | diff | gc]"),
@@ -68,11 +69,12 @@ int cmd_rerere(int argc, const char **argv, const char *prefix)
69 return rerere(flags);
70
71 if (!strcmp(argv[0], "forget")) {
71 - const char **pathspec;
72 + struct pathspec pathspec;
73 if (argc < 2)
74 warning("'git rerere forget' without paths is deprecated");
74 - pathspec = get_pathspec(prefix, argv + 1);
75 - return rerere_forget(pathspec);
75 + parse_pathspec(&pathspec, 0, PATHSPEC_PREFER_CWD,
76 + prefix, argv + 1);
77 + return rerere_forget(&pathspec);
78 }
79
80 fd = setup_rerere(&merge_rr, flags);
rerere.c
+5 -4
@@ -6,6 +6,7 @@
6 #include "resolve-undo.h"
7 #include "ll-merge.h"
8 #include "attr.h"
9 +#include "pathspec.h"
10
11 #define RESOLVED 0
12 #define PUNTED 1
@@ -656,7 +657,7 @@ static int rerere_forget_one_path(const char *path, struct string_list *rr)
657 return 0;
658 }
659
659 -int rerere_forget(const char **pathspec)
660 +int rerere_forget(struct pathspec *pathspec)
661 {
662 int i, fd;
663 struct string_list conflict = STRING_LIST_INIT_DUP;
@@ -667,12 +668,12 @@ int rerere_forget(const char **pathspec)
668
669 fd = setup_rerere(&merge_rr, RERERE_NOAUTOUPDATE);
670
670 - unmerge_cache(pathspec);
671 + unmerge_cache(pathspec->raw);
672 find_conflict(&conflict);
673 for (i = 0; i < conflict.nr; i++) {
674 struct string_list_item *it = &conflict.items[i];
674 - if (!match_pathspec(pathspec, it->string, strlen(it->string),
675 - 0, NULL))
675 + if (!match_pathspec_depth(pathspec, it->string, strlen(it->string),
676 + 0, NULL))
677 continue;
678 rerere_forget_one_path(it->string, &merge_rr);
679 }
rerere.h
+3 -1
@@ -3,6 +3,8 @@
3
4 #include "string-list.h"
5
6 +struct pathspec;
7 +
8 #define RERERE_AUTOUPDATE 01
9 #define RERERE_NOAUTOUPDATE 02
10
@@ -16,7 +18,7 @@ extern void *RERERE_RESOLVED;
18 extern int setup_rerere(struct string_list *, int);
19 extern int rerere(int);
20 extern const char *rerere_path(const char *hex, const char *file);
19 -extern int rerere_forget(const char **);
21 +extern int rerere_forget(struct pathspec *);
22 extern int rerere_remaining(struct string_list *);
23 extern void rerere_clear(struct string_list *);
24 extern void rerere_gc(struct string_list *);