ALLOC_GROW(rerere_dir, rerere_dir_nr + 1, rerere_dir_alloc);
/* ... and add it in. */
rerere_dir_nr++;
- memmove(rerere_dir + pos + 1, rerere_dir + pos,
- (rerere_dir_nr - pos - 1) * sizeof(*rerere_dir));
+ MOVE_ARRAY(rerere_dir + pos + 1, rerere_dir + pos,
+ rerere_dir_nr - pos - 1);
rerere_dir[pos] = rr_dir;
scan_rerere_dir(rr_dir);
}
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);
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;
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)