git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v2] builtin/pack-objects.c: introduce `pack.extraCruftTips`

From
Jeff King <peff@peff.net>
Date
May 6, 2023, 02:12 UTC
Message-ID
<20230506021255.GA3798242@coredump.intra.peff.net>
In-Reply-To
<ZFWbuf34pVxJyRiM@nand.local>
On Fri, May 05, 2023 at 08:13:45PM -0400, Taylor Blau wrote:
Show 13 quoted lines
> > @@ -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
Previous: Taylor BlauNext: Taylor Blau
Message 24 of 31 in “builtin/pack-objects.c: introduce `pack.extraCruftTips`”
  1. builtin/pack-objects.c: introduce `pack.extraCruftTips`Taylor Blau, Apr 20, 2023
  2. Junio C HamanoApr 20, 2023
  3. Taylor BlauApr 20, 2023
  4. Junio C HamanoApr 20, 2023
  5. Taylor BlauApr 20, 2023
  6. Chris TorekApr 21, 2023
  7. Taylor BlauApr 21, 2023
  8. Derrick StoleeApr 25, 2023
  9. Taylor BlauApr 25, 2023
  10. Derrick StoleeApr 26, 2023
  11. Taylor BlauMay 3, 2023
  12. builtin/pack-objects.c: introduce `pack.extraCruftTips`Taylor Blau, May 3, 2023
  13. Derrick StoleeMay 3, 2023
  14. Jeff KingMay 3, 2023
  15. Taylor BlauMay 3, 2023
  16. Jeff KingMay 5, 2023
  17. Taylor BlauMay 6, 2023
  18. Taylor BlauMay 6, 2023
  19. Taylor BlauMay 3, 2023
  20. Jeff KingMay 5, 2023
  21. Jeff KingMay 5, 2023
  22. Taylor BlauMay 6, 2023
  23. Taylor BlauMay 6, 2023
  24. Jeff KingMay 6, 2023
  25. builtin/pack-objects.c: introduce `pack.extraCruftTips`Taylor Blau, May 3, 2023
  26. Junio C HamanoMay 3, 2023
  27. Junio C HamanoMay 3, 2023
  28. Taylor BlauMay 3, 2023
  29. Taylor BlauMay 3, 2023
  30. Jeff KingMay 5, 2023
  31. Jeff KingMay 5, 2023

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.