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

Re: [PATCH 08/11] Allow for having for_each_ref() list some refs that aren't local

From
Daniel Barkalow <barkalow@iabervon.org>
Date
Mar 9, 2008, 06:23 UTC
Message-ID
<alpine.LNX.1.00.0803090116430.19665@iabervon.org>
In-Reply-To
<7vd4q4sg5r.fsf@gitster.siamese.dyndns.org>
On Sat, 8 Mar 2008, Junio C Hamano wrote:
Show 14 quoted lines
> Daniel Barkalow <barkalow@iabervon.org> writes:
> 
> > This is useful, for example, for listing the refs in a reference
> > repository during clone, when you don't have your own refs that cover
> > the objects that are in your alternate repository.
> 
> I hate to ask a question that I myself do not have a good answer to, but
> it is a bit worrysome that using these extra refs would cause for-each-ref
> to report different refs with the same name (the alternate's master branch
> and this one's master branch are both called refs/heads/master).
> 
> I think no caller that reads from for_each_ref() keeps track of names that
> it has seen and tries clever things like flagging duplicates as errors,
> but it still feels like it is inviting trouble.

I considered that, and didn't come to any particular conclusion about anything to do about it. In the particular case in this series, there are no non-extra refs, and the for_each_ref caller doesn't actually look at names at all, so it's really not a problem, but the interface could definitely generate odd results. For that matter, non-extra refs are sorted by name, and the extra refs are just done first. I think additional callers are needed before we can determine in more detail how the interface should work, since none of these details matters at all to this one.

	-Daniel
*This .sig left intentionally blank*
Previous: Junio C Hamano
Message 5 of 5 in “Allow for having for_each_ref() list some refs that aren't local”
  1. 08/11 Allow for having for_each_ref() list some refs that aren't localDaniel Barkalow, Mar 8, 2008
  2. Johannes SchindelinMar 8, 2008
  3. Daniel BarkalowMar 8, 2008
  4. Junio C HamanoMar 9, 2008
  5. Daniel BarkalowMar 9, 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.