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

Re: [PATCH] ref-filter: fix stale parsed objects

From
Jeff King <peff@peff.net>
Date
Nov 4, 2025, 22:04 UTC
Message-ID
<20251104220454.GC2618884@coredump.intra.peff.net>
In-Reply-To
<20251104211130.GA2618884@coredump.intra.peff.net>
On Tue, Nov 04, 2025 at 04:11:30PM -0500, Jeff King wrote:
Show 10 quoted lines
> I actually wonder if there is any other placeholder that benefits at
> all. The ref-filter code already tries to avoid doing unneeded work. The
> most obvious there is not loading the object at all, which is why stuff
> like "%(refname) %(objectname)" is faster than adding in %(raw), which
> needs the object contents (but no parsing). And likewise stuff like
> %(tag) needs parsing, and thus also triggers loading the object.
> 
> So 054f5f457e helps formats which require the object contents but _not_
> parsing. I can't think of another placeholder besides %(raw) which would
> benefit from that.

BTW, the one other oddity I aw while looking at this is %(describe). It asks for SOURCE_OBJ, which causes ref-filter to load the object. But we don't need it! We're just going to call out to git-describe.

But just changing that SOURCE_ flag is not enough, since we call grab_describe_values() from deep inside grab_values(), which we do after getting the object content. We'd have to move that call further up, but taking care to handle both deref=0 and deref=1 cases. Or maybe not? Does git-describe always return the same answer when describing a tag versus what it points to? In which case it should be more like how the AHEAD_BEHIND atom works.

At any rate, I was sufficiently grossed out by the ref-filter code that I stopped poking at it. Loading the objects is an unnecessary inefficiency, but compared to spawning a separate git-describe process, it is probably peanuts. So somebody who cares more can dig further if they want.

-Peff
Previous: Jeff KingNext: Patrick Steinhardt
Message 5 of 7 in “ref-filter: fix stale parsed objects”
  1. ref-filter: fix stale parsed objectsPatrick Steinhardt, Nov 4, 2025
  2. Junio C HamanoNov 4, 2025
  3. Junio C HamanoNov 4, 2025
  4. Jeff KingNov 4, 2025
  5. Jeff KingNov 4, 2025
  6. Patrick SteinhardtNov 6, 2025
  7. Jeff KingNov 4, 2025

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.