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

Re: [PATCH v2.5 2/2] tag: prevent nested tags

From
Denton Liu <liu.denton@gmail.com>
Date
Apr 3, 2019, 21:33 UTC
Message-ID
<20190403213318.GA14137@dev-l>
In-Reply-To
<xmqqzhp7sfw4.fsf@gitster-ct.c.googlers.com>
On Wed, Apr 03, 2019 at 04:32:27PM +0900, Junio C Hamano wrote:
Show 8 quoted lines
> Denton Liu <liu.denton@gmail.com> writes:
> 
> > This is the first use of the '%n$<fmt>' style of printf format in the
> > *.[ch] files in our codebase, but it's supported by POSIX[1] and there
> > are existing uses for it in po/*.po files, so hopefully it won't cause
> 
> The latter is a stronger indication that this should be OK than the
> former ;-)  Thanks for digging and noting.

Thank Ævar, I shamelessly stole this message from one of his patches that didn't get included in[1].

Show 28 quoted lines
> 
> > diff --git a/Documentation/config/advice.txt b/Documentation/config/advice.txt
> > index 88620429ea..ec4f6ae658 100644
> > --- a/Documentation/config/advice.txt
> > +++ b/Documentation/config/advice.txt
> > @@ -90,4 +90,6 @@ advice.*::
> >  	waitingForEditor::
> >  		Print a message to the terminal whenever Git is waiting for
> >  		editor input from the user.
> > +	nestedTag::
> > +		Advice shown if a user attempts to recursively tag a tag object.
> >  --
> 
> In addition to 'advice', we may have to add a configuration to help
> projects that wants to tag tag objects regularly so that they do not
> have to keep typing "--allow-nested-tag".  But that can wait until a
> participant of such a project comes forward and makes a case for
> their workflow.
> 
> > +chain of custody by signing someone else's signed tag. However, in
> > +practice, this is typically a mistake so we prevent it from happening by
> > +default unless specifically requested.
> 
> I am not sure if this is so bad, actually.  Why do we need to treat
> it as a mistake?  When a command that wants a commit is fed a tag
> (either a tag that directly refers to a commit, or a tag that tags
> another tag that refers to a commit), the command knows how to peel
> so it's not like the user is forced to say "git log T^{commit}".

This patch came about because Robert Dailey expressed confusion after accidentally creating a tag-to-a-tag a while back by mistake when he actually meant to amend a tag.

In the discussion upthread, Peff noted that he has never seen a tag-to-a-tag in the wild before. I think the conclusion was that for the majority of users, doing this is an error. That is what this patch is guarding against.

Show 10 quoted lines
> 
> And if something that *MUST* take a commit refuses to (or more
> likely, forges to) peel a tag down to a commit and yields an error,
> I think that is what needs fixing, not the command that creates a
> tag.
> 
> So, I am fairly negative on this change---unless it is made much
> more clear in the doc and/or in the proposed log message what
> practical downside there are to the end users if we do not stop this
> "mistake", that is.
I can update the log message to include more detail.
Show 6 quoted lines
> 
> > +Automatically erroring on nested tags was introduced in Git version
> > +2.22.0.
> 
> And please do not write something like this.  A feature gets in a
> release when it is ready, and we may not ship this in 2.22.

Ævar suggested that we include this because git tag gets used by a lot of scripts so in case one ever starts failing, a maintainer can more easily track down the reason why.

Show 10 quoted lines
> 
> "git tag --help" the user is running may or may not have the
> paragraph about "nested tag", depending on the existence of the
> feature in the version of Git the user is running, so there is no
> need to say something like that.
> 
> And no, I do not buy arguments like "random web servers serve
> different versions of documentation without identifying which
> version of Git they describe".
> 
Thanks for the comments,
Denton
[1]: https://public-inbox.org/git/20181026192734.9609-8-avarab@gmail.com/
Previous: Johannes SixtNext: Jeff King
Message 36 of 48 in “Strange annotated tag issue”
  1. Robert DaileyMar 21, 2019
  2. Bryan TurnerMar 21, 2019
  3. Jeff KingMar 21, 2019
  4. Jeff KingMar 21, 2019
  5. Robert DaileyMar 25, 2019
  6. Jeff KingMar 25, 2019
  7. Robert DaileyMar 25, 2019
  8. Bryan TurnerMar 25, 2019
  9. Jeff KingMar 25, 2019
  10. Ævar Arnfjörð BjarmasonMar 25, 2019
  11. Jeff KingMar 25, 2019
  12. 0/3 tag: prevent recursive tagsDenton Liu, Mar 26, 2019
  13. 1/3 tag: prevent recursive tagsDenton Liu, Mar 26, 2019
  14. Denton LiuMar 26, 2019
  15. Ævar Arnfjörð BjarmasonMar 26, 2019
  16. Elijah NewrenMar 27, 2019
  17. Ævar Arnfjörð BjarmasonMar 27, 2019
  18. Robert DaileyMar 28, 2019
  19. 2/3 t7004: ensure recursive tag behavior is workingDenton Liu, Mar 26, 2019
  20. Ævar Arnfjörð BjarmasonMar 26, 2019
  21. 3/3 git-tag.txt: document --allow-recursive-tag optionDenton Liu, Mar 26, 2019
  22. Ævar Arnfjörð BjarmasonMar 26, 2019
  23. Jeff KingMar 26, 2019
  24. 0/2 tag: prevent nested tagsDenton Liu, Apr 2, 2019
  25. 1/2 tag: fix formattingDenton Liu, Apr 2, 2019
  26. 2/2 tag: prevent nested tagsDenton Liu, Apr 2, 2019
  27. 2/2 tag: prevent nested tagsDenton Liu, Apr 2, 2019
  28. Junio C HamanoApr 3, 2019
  29. Junio C HamanoApr 3, 2019
  30. Robert DaileyApr 3, 2019
  31. Junio C HamanoApr 4, 2019
  32. Robert DaileyApr 4, 2019
  33. Junio C HamanoApr 4, 2019
  34. Robert DaileyApr 5, 2019
  35. Johannes SixtApr 3, 2019
  36. Denton LiuApr 3, 2019
  37. Jeff KingApr 4, 2019
  38. Junio C HamanoApr 4, 2019
  39. Jeff KingApr 4, 2019
  40. Junio C HamanoApr 4, 2019
  41. Jeff KingApr 4, 2019
  42. Eckhard MaaßApr 11, 2019
  43. Junio C HamanoApr 12, 2019
  44. Elijah NewrenApr 5, 2019
  45. Junio C HamanoApr 5, 2019
  46. 0/2 tag: advise on recursive taggingDenton Liu, Apr 4, 2019
  47. 1/2 tag: fix formattingDenton Liu, Apr 4, 2019
  48. 2/2 tag: advise on nested tagsDenton Liu, Apr 4, 2019

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.