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

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

From
Junio C Hamano <gitster@pobox.com>
Date
Apr 4, 2019, 21:50 UTC
Message-ID
<xmqqimvte8yr.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<CAHd499Dr5sjzFCFYvkwcS0WOo0W51_RyL7nLAg_MaGeFy5eQKQ@mail.gmail.com>
Robert Dailey <rcdailey.lists@gmail.com> writes:
> It might be fine within the realm of git itself, because git knows how
> to deal with them by peeling, as you say, but there are 3 reasons I
> dislike that this is allowed:

That sounds as if you have tools that forgets to peel when it should in mind. Isn't that what you should be looking into fixing? After all, tools that aim to work with Git should strive to come close to "within the realm of git itsef" in the modern world.

> 1. The intent by the user was to create a tag pointing to the commit
> that another tag points to.

You make it sound as if you are convinced that is the truth. I am not. If I want to tag the commit pointed at by tag v1.0, I'd say I want to tag "v1.0^0", because otherwise there won't be a way to say

    $ git tag -s -m "i am aware of this tag" initial v1.0

i.e. making a tag that points at a tag. So I take the lack of ^0 (or ^{commit}) peeling an explicit sign that shows the intent by the user (well, those who know the tool, anyway) is clearly to create a tag pointing to that tag. In other words, peeling at the tagging time is wrong, and rejecting tag creation is also wrong.

> 2. When users on my team do a `git show tag`, they see 2 descriptions
> and 2 tags. This creates a LOT of confusion.
So what?  Not everybody will forever stay to be a newbie ;-) 

As I said, an opt-in tag.allowCommitOnly is fine. That would train their fingers to peel with ^{commit} when they want to tag a commit. An opt-in tag.autoPeelTags might also be fine, even though that would not help training their fingers (so they will have to be prepared for the same "confusion" on a fresh machine)

When the command line clearly tells us that the user wants to tag a tag, we should not get overly "smart" and refuse to create a tag of a tag, unless the user tells us otherwise with some means.

> 3. Even if Git internally handles peeling tags, external 3rd party
> tooling may not. As I mentioned in another thread, `git lfs migrate`
> was not programmed to peel tags. I reported the issue here:

That is good, and it is the right way. After all, external 3rd party tooling may tag a tag even after we castrate "git tag" to be incapable of doing so, so a bug like the one you are helping to fix in lfs needs to be fixed anyway. In other words, thats the only sensible way forward when you care about the entire Git ecosystem, not just the main/reference implementation we work on here.

Previous: Robert DaileyNext: Robert Dailey
Message 33 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.