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

Re: [PATCH 3/4] for-each-ref --format='%(symref) %(symref:short)'

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 14, 2010, 10:32 UTC
Message-ID
<7vy6iwp0oy.fsf@alter.siamese.dyndns.org>
In-Reply-To
<20100214063243.GA20630@coredump.intra.peff.net>
Jeff King <peff@peff.net> writes:
> It feels ugly that we need to re-resolve the ref when we simply threw
> that information away earlier from when we called resolve_ref in
> get_ref_dir...

It is true and I indeed thought about it while doing the patch, but "how often would we see symref in the entire refs list, and what percentage of callers would benefit from seeing this information?" stopped me from going further in that direction.

> ...
> If we were going to do this for real, I would be tempted to actually
> change the signature of each_ref_fn to take a struct so this doesn't
> come up again.

That would actually be sensible. Adding symref parameter all over just so that we do not have to re-resolve symbolic refs in a few codepaths feels like a "it would have been nicer if things were that way from day one, but how much does that churn really buys us now" kind of change, but carrying the full information around in the internal API is a "right thing to do".

Previous: Jeff KingNext: Jeff King
Message 6 of 8 in “for-each-ref --format='%(symref) %(symref:short) %(flag)'”
  1. 0/4 for-each-ref --format='%(symref) %(symref:short) %(flag)'Junio C Hamano, Feb 13, 2010
  2. 1/4 builtin-for-each-ref.c: comment fixesJunio C Hamano, Feb 13, 2010
  3. 2/4 builtin-for-each-ref.c: check if we need to peel onion while parsing the formatJunio C Hamano, Feb 13, 2010
  4. 3/4 for-each-ref --format='%(symref) %(symref:short)'Junio C Hamano, Feb 13, 2010
  5. Jeff KingFeb 14, 2010
  6. Junio C HamanoFeb 14, 2010
  7. Jeff KingFeb 15, 2010
  8. 4/4 for-each-ref --format='%(flag)'Junio C Hamano, Feb 13, 2010

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.