On Fri, Dec 03, 2021 at 03:08:00PM -0500, Taylor Blau wrote: > On Fri, Dec 03, 2021 at 11:51:51AM -0800, Junio C Hamano wrote: > > Stepping back a bit, I do not see how we can get away without doing > > the same .mtimes file for non-cruft packs. An object that is in a > > non-cruft pack may be referenced immediately after the repack that > > created the pack, but the ref that was referencing the object may > > have gone away and now the pack is a month old. If we were to > > repack the object, we do not know when was the last time the object > > was reachable from any of the refs and index entries (collectively > > known as anchor points). > > In that situation, we would use the mtime of the pack which contains > that object itself as a proxy (or the mtime of a loose copy of the > object, if it is more recent). > > That isn't perfect, as you note, since if the pack isn't otherwise > freshened, we'd consider that object to be a month old, even if the > reference pointing at it was deleted a mere second ago. > > I can't recall if Peff and I talked about this off-list, but I have a > vague sense we probably did (and I forgot the details). Maybe I can rephrase the problem as being orthogonal to what we're addressing here. Modification time can be a useful-ish proxy for "last referenced time", but they are ultimately different. Forgetting cruft packs for a moment, our behavior today in that situation would be to prune the object if our grace period did not cover the time in which the pack was last modified. So if the pack was a month old, the grace period was two weeks, but the reference pointing at some object in that pack was deleted only a second before starting a pruning GC, we'd prune that object before this series (just as we would do the same thing with this series). Aside from pruning, what happens to the value recorded in the .mtimes file is more interesting. For the case you're talking about, we'll err on the side of newer mtimes (either the original timestamp is recorded, or some future time when the containing pack was rewritten). But the more interesting case is when an object becomes re-referenced. Since the ref-update doesn't cause the object to be rewritten, we wouldn't change the timestamp. Anyway, both of these are still independent from cruft packs, so we're not changing the status quo there, I don't think. Thanks, Taylor