Describe git-clone's actual behavior in the summary
[gitweb.git] / builtin-rerere.c
index d064bd8bf0218feb7d4ad01b39be6a143757499e..079c0bdf36abce6a34af2678f7efbb56dfcfdf41 100644 (file)
@@ -350,11 +350,10 @@ static int do_plain_rerere(struct path_list *rr, int fd)
                fprintf(stderr, "Recorded resolution for '%s'.\n", path);
                copy_file(path, rr_path(name, "postimage"));
 tail_optimization:
-               if (i < rr->nr - 1) {
+               if (i < rr->nr - 1)
                        memmove(rr->items + i,
-                                       rr->items + i + 1,
-                                       rr->nr - i - 1);
-               }
+                               rr->items + i + 1,
+                               sizeof(rr->items[0]) * (rr->nr - i - 1));
                rr->nr--;
                i--;
        }
@@ -362,6 +361,17 @@ static int do_plain_rerere(struct path_list *rr, int fd)
        return write_rr(rr, fd);
 }
 
+static int git_rerere_config(const char *var, const char *value)
+{
+       if (!strcmp(var, "gc.rerereresolved"))
+               cutoff_resolve = git_config_int(var, value);
+       else if (!strcmp(var, "gc.rerereunresolved"))
+               cutoff_noresolve = git_config_int(var, value);
+       else
+               return git_default_config(var, value);
+       return 0;
+}
+
 int cmd_rerere(int argc, const char **argv, const char *prefix)
 {
        struct path_list merge_rr = { NULL, 0, 0, 1 };
@@ -371,6 +381,8 @@ int cmd_rerere(int argc, const char **argv, const char *prefix)
        if (stat(git_path("rr-cache"), &st) || !S_ISDIR(st.st_mode))
                return 0;
 
+       git_config(git_rerere_config);
+
        merge_rr_path = xstrdup(git_path("rr-cache/MERGE_RR"));
        fd = hold_lock_file_for_update(&write_lock, merge_rr_path, 1);
        read_rr(&merge_rr);