Code

tests: consolidate CR removal/addition functions
[git.git] / builtin-rerere.c
index 7ec602cf55fd39ee5ae5b84831ccd5b583795631..34f9acee910406c7ba0bf9eed76267a0cf8f46c2 100644 (file)
@@ -48,6 +48,8 @@ static void garbage_collect(struct string_list *rr)
 
        git_config(git_rerere_gc_config, NULL);
        dir = opendir(git_path("rr-cache"));
+       if (!dir)
+               die_errno("unable to open rr-cache directory");
        while ((e = readdir(dir))) {
                if (is_dot_or_dotdot(e->d_name))
                        continue;
@@ -118,6 +120,11 @@ int cmd_rerere(int argc, const char **argv, const char *prefix)
        if (argc < 2)
                return rerere(flags);
 
+       if (!strcmp(argv[1], "forget")) {
+               const char **pathspec = get_pathspec(prefix, argv + 2);
+               return rerere_forget(pathspec);
+       }
+
        fd = setup_rerere(&merge_rr, flags);
        if (fd < 0)
                return 0;