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 18, 2020, 19:54 UTC
Message-ID
<20200218195402.GA21586@coredump.intra.peff.net>
In-Reply-To
<xmqqd0abk7zc.fsf@gitster-ct.c.googlers.com>
On Tue, Feb 18, 2020 at 11:31:35AM -0800, Junio C Hamano wrote:
Show 11 quoted lines
> Jeff King <peff@peff.net> writes:
> 
> > I think the conversion of the die() to warning() makes sense here. Do we
> > want to cover that with a test?
> 
> I presume that you are talking about this case.
> 
> >  	if (n->tag && !n->name_checked) {
> >  		if (!n->tag->tag)
> > -			die(_("annotated tag %s has no embedded name"), n->path);
> > +			warning(_("annotated tag %s has no embedded name"), n->path);
Yep, that's the one.
> The attached is my attempt to craft such a test.  It turns out that
> it is tricky to trigger this die/warning.  I haven't dug deeply
> enough, but I suspect this might be a dead code now.

Thanks for digging so deeply on this. I think you're right that we'll never get a "struct tag" with a NULL tag field because parse_tag_buffer() unconditionally puts something there or returns an error.

We probably used to be able to trigger this by "double parsing" the tag (probably with two refs pointing at the same tag object), in which case the first would mark it as parsed but return an error, and the second would quietly return "oh, it's already parsed". But I fixed that recently in 228c78fbd4 (commit, tag: don't set parsed bit for parse failures, 2019-10-25).

So yeah, I think I'd be OK to turn this into a BUG(), or just eliminate it entirely (we'd segfault, which is BUG-equivalent ;) ).

-Peff
Previous: Junio C HamanoNext: Junio C Hamano
Message 8 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.