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

Re: [PATCH] describe: output tag's ref instead of embedded name

From
Jeff King <peff@peff.net>
Date
Feb 21, 2020, 05:58 UTC
Message-ID
<20200221055851.GE1280313@coredump.intra.peff.net>
In-Reply-To
<xmqq4kvlcgcz.fsf@gitster-ct.c.googlers.com>
On Thu, Feb 20, 2020 at 09:34:36AM -0800, Junio C Hamano wrote:
Show 11 quoted lines
> > The "-g$objectname" one is kind of clever, and definitely not something
> > I had thought of. We already have "--long", and of course we'd show the
> > long version for any name that isn't an exact match anyway. So as an
> > added bonus, it seems unlikely to surprise anybody who is expecting the
> > current "show the tag, not the refname" output (though again, this is
> > rare enough that I think people simply expect them to be the same ;) ).
> 
> There is one thing you may have brought up in the discussion but I
> did not touch.  Using v1.0-0-g0123456, based on tagname "v1.0" Bob
> gave to it would still describe the right object, but if the user
> forced "--no-long", it becomes unclear what we should do.

I think "--no-long" is not "do not ever write a long name". It is "counteract an earlier request to _always_ print long names". I.e.:

  $ git describe --no-long v2.25.1^
  v2.25.0-99-g6141e0cc00

still produces long output regardless of your patch. And if we continue to do so in the wrongly-named case (which your patch seems to), that would be consistent.

Show 6 quoted lines
> Another thing that is not satisfying is what should happen in "all"
> mode.  We add "tags/" prefix so in the case we've been discussing,
> the output would be "tags/v1.0-0-g0123456", but the whole reason why
> we add the prefix is to say that the early part of the name, "v1.0",
> is a tag, and it would be natural to associate it with refs/tags/v1.0
> that is *not* Bob's tag.

I agree that is not fantastic, but the same problem is there to some degree even without the "tags/" prefix. The prefix just makes you think more of the ref namespace. :) I think it's the best we can do, given that we'll also have just issued a warning.

Speaking of which...
Show 6 quoted lines
> Having said all that, here is what I have at this moment.
> [...]
> While at it, remove an overly cautious dead code to protect against
> an annotated tag object without the tagname.  Such a tag is filtered
> out much earlier in the codeflow, and will not reach this part of
> the code.

This patch also reverses the order of the warning from "is really" to "is externally known as", but I didn't see it mentioned in the commit message.

-Peff
Previous: Jeff KingNext: Roland Hieber
Message 22 of 23 in “git-describe --tags warning: 'X' is really 'Y' here”
  1. Roland HieberFeb 5, 2020
  2. Matheus Tavares BernardinoFeb 5, 2020
  3. Jeff KingFeb 14, 2020
  4. Junio C HamanoFeb 14, 2020
  5. describe: output tag's ref instead of embedded nameMatheus Tavares, Feb 15, 2020
  6. Jeff KingFeb 16, 2020
  7. Junio C HamanoFeb 18, 2020
  8. Jeff KingFeb 18, 2020
  9. Junio C HamanoFeb 18, 2020
  10. Junio C HamanoFeb 18, 2020
  11. Jeff KingFeb 19, 2020
  12. Junio C HamanoFeb 19, 2020
  13. Jeff KingFeb 19, 2020
  14. Junio C HamanoFeb 19, 2020
  15. Jeff KingFeb 20, 2020
  16. Junio C HamanoFeb 20, 2020
  17. Matheus Tavares BernardinoFeb 20, 2020
  18. Junio C HamanoFeb 20, 2020
  19. Matheus TavaresFeb 21, 2020
  20. Junio C HamanoFeb 21, 2020
  21. Jeff KingFeb 21, 2020
  22. Jeff KingFeb 21, 2020
  23. Roland HieberFeb 19, 2020

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.