diff options
author | Junio C Hamano <gitster@pobox.com> | 2010-08-31 16:14:27 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2010-08-31 16:14:27 -0700 |
commit | e24058f57f4e76e38e20390c5927590f3cd48085 (patch) | |
tree | d8f9b7149447d6d1be6ea847b807d247d3356fd4 /builtin | |
parent | gitweb: Don't die_error in git_tag after already printing headers (diff) | |
parent | rerere: fix overeager gc (diff) | |
download | tgif-e24058f57f4e76e38e20390c5927590f3cd48085.tar.xz |
Merge branch 'sg/rerere-gc-old-still-used'
* sg/rerere-gc-old-still-used:
rerere: fix overeager gc
mingw_utime(): handle NULL times parameter
Diffstat (limited to 'builtin')
-rw-r--r-- | builtin/rerere.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/builtin/rerere.c b/builtin/rerere.c index 9b1e3a7cf5..67793fa2c7 100644 --- a/builtin/rerere.c +++ b/builtin/rerere.c @@ -19,6 +19,12 @@ static time_t rerere_created_at(const char *name) return stat(rerere_path(name, "preimage"), &st) ? (time_t) 0 : st.st_mtime; } +static time_t rerere_last_used_at(const char *name) +{ + struct stat st; + return stat(rerere_path(name, "postimage"), &st) ? (time_t) 0 : st.st_mtime; +} + static void unlink_rr_item(const char *name) { unlink(rerere_path(name, "thisimage")); @@ -53,11 +59,16 @@ static void garbage_collect(struct string_list *rr) while ((e = readdir(dir))) { if (is_dot_or_dotdot(e->d_name)) continue; - then = rerere_created_at(e->d_name); - if (!then) - continue; - cutoff = (has_rerere_resolution(e->d_name) - ? cutoff_resolve : cutoff_noresolve); + + then = rerere_last_used_at(e->d_name); + if (then) { + cutoff = cutoff_resolve; + } else { + then = rerere_created_at(e->d_name); + if (!then) + continue; + cutoff = cutoff_noresolve; + } if (then < now - cutoff * 86400) string_list_append(&to_remove, e->d_name); } |