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 15, 2009, 08:03 UTC
Message-ID
<20090415080301.GD23332@coredump.intra.peff.net>
In-Reply-To
<49E487B2.5030606@drmicha.warpmail.net>
On Tue, Apr 14, 2009 at 02:55:14PM +0200, Michael J Gruber wrote:
Show 12 quoted lines
> >   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);
> 
> Should I rebase this on top of Bert's newer patch (which has the
> signature you suggest)? Currently I don't see any of them in.

It has the same signature, but the meanings are different. My flag meant "should we bother looking at ambiguity at all?" whereas Bert's flag is about "how strictly should we be counting ambiguity?".

So really there are three levels, which implies an enum (with none, loose, and strict). However, calling it with a tri-state flag would be less convenient, since your logic for the flag is:

  if (we are shortening something non-local)
    flag = none;
  else if (core.warn_ambiguous_refs is not set)
    flag = loose;
  else
    flag = strict;
So you really want to pass the two bits of information separately.
-Peff
Previous: Michael J GruberNext: Junio C Hamano
Message 4 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.