On Fri, May 05, 2023 at 08:13:45PM -0400, Taylor Blau wrote: > > @@ -78,7 +144,7 @@ static void add_recent_object(const struct object_id *oid, > > struct object *obj; > > enum object_type type; > > > > - if (mtime <= data->timestamp) > > + if (!obj_is_recent(oid, mtime, data)) > > return; > > > > /* > > ...this hunk. That only kicks in if you have other recent object(s), > since the hooks are consulted as a side-effect of calling your new > `obj_is_recent()` function. I think we'll evaluate each object in the repo for recent-ness, via for_each_loose_object and for_each_packed_object. So if an object exists in the repo it will be evaluated here, as long as we are checking for recent objects at all. And if it doesn't exist, then having the hook tell us about it won't help; there is nothing for us to save (nor even to use as a source of reachability, since we don't know what's in it). Modulo the want_recent_object() thing you mentioned, of course, which is evaluated first. And I could see that yeah, that might need to let the hook override it, which shouldn't be too hard to do. I'm not super familiar with this aspect of the cruft pack code. That function is trying to avoid looking at objects that are in in-core kept packs, which implies repack feeding those via stdin. Looking at repack.c, we are feeding the existing packs we just wrote (so all of the reachable stuff). So I can see why we might skip those packs, but at the same time, we know we are keeping them (they were just written!) so they are not really cruft candidates anyway. If an extraCruftTips hook told us about them, would it matter? They are already being kept as non-cruft. But that is just an analysis based on 5 minutes of poking at the code. I won't be surprised if I'm misunderstanding it or missing subtle cases. -Peff