pull --rebase: Avoid spurious conflicts and reapplying unnecessary patches
[gitweb.git] / builtin-rerere.c
index 0253abf9b698ed10a8df5c21ef07c93b8e6460dc..34f9acee910406c7ba0bf9eed76267a0cf8f46c2 100644 (file)
@@ -103,17 +103,29 @@ static int diff_two(const char *file1, const char *label1,
 int cmd_rerere(int argc, const char **argv, const char *prefix)
 {
        struct string_list merge_rr = { NULL, 0, 0, 1 };
-       int i, fd;
-
+       int i, fd, flags = 0;
+
+       if (2 < argc) {
+               if (!strcmp(argv[1], "-h"))
+                       usage(git_rerere_usage);
+               if (!strcmp(argv[1], "--rerere-autoupdate"))
+                       flags = RERERE_AUTOUPDATE;
+               else if (!strcmp(argv[1], "--no-rerere-autoupdate"))
+                       flags = RERERE_NOAUTOUPDATE;
+               if (flags) {
+                       argc--;
+                       argv++;
+               }
+       }
        if (argc < 2)
-               return rerere();
+               return rerere(flags);
 
-       if (!strcmp(argv[1], "-h"))
-               usage(git_rerere_usage);
-       else if (!strcmp(argv[1], "forget"))
-               return rerere_forget(argv + 2);
+       if (!strcmp(argv[1], "forget")) {
+               const char **pathspec = get_pathspec(prefix, argv + 2);
+               return rerere_forget(pathspec);
+       }
 
-       fd = setup_rerere(&merge_rr);
+       fd = setup_rerere(&merge_rr, flags);
        if (fd < 0)
                return 0;