From: Junio C Hamano Date: Tue, 29 Jun 2010 17:59:15 GMT Subject: Re: [RFC PATCH] rerere: fix overeager gc Message-ID: <7vy6dx90uk.fsf@alter.siamese.dyndns.org> In-Reply-To: <1277811498-17288-1-git-send-email-szeder@ira.uka.de> SZEDER Gábor writes: > ... But I'm not sure I > can rely on that when gc'ing. Looking at the timestamp of "thisimage" would probaboly be more sensible than "preimage" alone, _if_ "thisimage" still exists. It is rewritten every time this particular conflict is observed; this is not necessarily when the recorded resolution is _used_, but it may be close enough in practice. You probably would want to rename the helper as "last_checked_at", though. After rerere does its work, however, "thisimage" does not have to stay around (the user can remove it, or we could enhance "gc" to do so). > + if (has_rerere_resolution(e->d_name)) { > + then = rerere_last_used_at(e->d_name); > + if (!then) > + continue; Here you already know that you have resolution (i.e. "postimage"), but your new function cannot stat a corresponding "thisimage", so you err on the safer side---but that means you may keep pre/post image pairs forever if somebody removes otherwise unused "thisimage" from a distant past. Perhaps we should apply cutoff_noresolve to the entry here? One possibility is to look at the timestamp of the directory itself instead. Then we can safely gc otherwise-unused "thisimage" file when rerere is not in use. I wonder if directory m_time timestamps are usable for this purpose on non-POSIX platforms?