commit: add support for --fixup <commit> -m"<extra message>"
[gitweb.git] / rerere.c
index f0b4bce881963b8e757354f8a022d09e239dcc81..1ce440f4bb84d001ff2b0ac1a67772f4bf5926c0 100644 (file)
--- a/rerere.c
+++ b/rerere.c
@@ -258,7 +258,7 @@ static int write_rr(struct string_list *rr, int out_fd)
                                    rerere_id_hex(id),
                                    rr->items[i].string, 0);
 
-               if (write_in_full(out_fd, buf.buf, buf.len) != buf.len)
+               if (write_in_full(out_fd, buf.buf, buf.len) < 0)
                        die("unable to write rerere record");
 
                strbuf_release(&buf);
@@ -1176,16 +1176,6 @@ static void prune_one(struct rerere_id *id,
                unlink_rr_item(id);
 }
 
-static void config_get_expiry(const char *key, timestamp_t *cutoff, timestamp_t now)
-{
-       int days;
-
-       if (!git_config_get_int(key, &days)) {
-               const int scale = 86400;
-               *cutoff = now - days * scale;
-       }
-}
-
 void rerere_gc(struct string_list *rr)
 {
        struct string_list to_remove = STRING_LIST_INIT_DUP;
@@ -1199,8 +1189,8 @@ void rerere_gc(struct string_list *rr)
        if (setup_rerere(rr, 0) < 0)
                return;
 
-       config_get_expiry("gc.rerereresolved", &cutoff_resolve, now);
-       config_get_expiry("gc.rerereunresolved", &cutoff_noresolve, now);
+       git_config_get_expiry_in_days("gc.rerereresolved", &cutoff_resolve, now);
+       git_config_get_expiry_in_days("gc.rerereunresolved", &cutoff_noresolve, now);
        git_config(git_default_config, NULL);
        dir = opendir(git_path("rr-cache"));
        if (!dir)