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

Re: [PATCH] remote.c: use shorten_unambiguous_ref

From
Jeff King <peff@peff.net>
Date
Apr 10, 2009, 17:14 UTC
Message-ID
<20090410171458.GA26478@sigill.intra.peff.net>
In-Reply-To
<1239291182-12860-1-git-send-email-git@drmicha.warpmail.net>
On Thu, Apr 09, 2009 at 05:33:02PM +0200, Michael J Gruber wrote:
> Use the new shorten_unambiguous_ref() for simplifying the output of
> upstream branch names. This affects status and checkout.

Yeah, this is the spot I was thinking about when I mentioned "use it in other places" earlier in the thread. So

Acked-by: Jeff King <peff@peff.net>
> I haven't seen more obvious place for using shorten_unambiguous_ref().
> prettify_ref() is a natural candidate but is mostly used for
> prettyfying refs on the remote side. git branch is covered by Jeff's
> patch already.

Hmm. I was thinking we might be able to just do away with prettify_ref, but I didn't consider the fact that we need to prettify remote things. I think you could still unambiguously prettify the local half of those callsites, though.

Given that the two functions are closely related, should we perhaps rename them to

  const char *shorten_ref(const char *);
  const char *shorten_ref_unambiguous(const char *);

? The implementations are quite different, with prettify_ref not really respecting the ref lookup rules, but rather just considering a few pre-determined bits of the hierarchy as uninteresting. It shouldn't be that hard to have them both use the same implementation, like:

  const char *shorten_ref(const char *, int unambiguous);
-Peff
Previous: Michael J GruberNext: Michael J Gruber
Message 2 of 7 in “remote.c: use shorten_unambiguous_ref”
  1. remote.c: use shorten_unambiguous_refMichael J Gruber, Apr 9, 2009
  2. Jeff KingApr 10, 2009
  3. Michael J GruberApr 14, 2009
  4. Jeff KingApr 15, 2009
  5. Junio C HamanoApr 14, 2009
  6. Bert WesargApr 14, 2009
  7. Jeff KingApr 15, 2009

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.