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

Re: [PATCH 1/3] git-pack-objects: Automatically pack annotated tags if object was packed

From
Shawn O. Pearce <spearce@spearce.org>
Date
Mar 4, 2008, 03:06 UTC
Message-ID
<20080304030631.GN8410@spearce.org>
In-Reply-To
<alpine.LNX.1.00.0803032145480.19665@iabervon.org>
Daniel Barkalow <barkalow@iabervon.org> wrote:
Show 8 quoted lines
> On Mon, 3 Mar 2008, Shawn O. Pearce wrote:
> 
> > +	if (auto_tags && nr_result)
> > +		for_each_ref(add_ref_tag, NULL);
> 
> There's for_each_tag_ref() that does the path-based filter internally, in 
> a possibly more efficient way, and avoids open-coding the test for whether 
> this is a tag sort of ref.

Yea, I know about that call, but I didn't use it because I was trying to use peel_ref() for its optimized peeled caching in a packed-refs file.

To use peel_ref() you have to pass the full ref name ("refs/tags/v1.0") and not a partial ref name ("v1.0") such as for_each_tag_ref() will return to the callback function. So I'd have to actually do extra work to reconstruct a ref name, and possibly an invalid ref name at that if for_each_tag_ref() ever looked outside of the refs/tags/ namespace.

Today there is no performance benefit to for_each_tag_ref() over for_each_ref(), but using for_each_ref() lets me use peel_ref(), which is a performance improvement if the ref in question came from the packed-refs file.

So.... do we keep things as-is or try to optimize peel_ref() (or some new variant of it?!?) for use in for_each_tag_ref() just on the off chance that we somehow can optimize for_each_tag_ref to avoid scanning refs/heads/? Note that I did look into trying to do that optimization to for_each_tag_ref() earlier last week and concluded it wasn't easily possible right now, and wasn't likely to be worth the development costs.

-- 
Shawn.
Previous: Daniel BarkalowNext: Daniel Barkalow
Message 7 of 8 in “git-pack-objects: Automatically pack annotated tags if object was packed”
  1. 1/3 git-pack-objects: Automatically pack annotated tags if object was packedShawn O. Pearce, Mar 4, 2008
  2. Nicolas PitreMar 4, 2008
  3. Shawn O. PearceMar 4, 2008
  4. Johannes SixtMar 4, 2008
  5. Shawn O. PearceMar 5, 2008
  6. Daniel BarkalowMar 4, 2008
  7. Shawn O. PearceMar 4, 2008
  8. Daniel BarkalowMar 4, 2008

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.