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

From: "Eckhard Maaß" <[email-masked]>
Date: Thu, 11 Apr 2019 20:40:31 +0200

On Thu, Apr 04, 2019 at 08:27:22AM -0400, Jeff King wrote:
> IMHO the difference between those cases is that it is very easy to type
> something natural to get a tag of tag, like:
> 
>   git tag -m foo mytag
>   # oops, try again
>   git tag -m bar -f mytag mytag

Could it be that the semantics of `-f` are unintuitive and the real
culprit? The documentation talks about replacing the tag, which at least
naively to me has the sense of "well, the old tag object gets garbage
collected sometimes". But if the tag is still referenced, the old tag
hangs around. And this gets quite confusing. For example:

git tag -m 'Message' -a myTag
git tag -m 'Message' -a myOtherTag myTag
git tag -m 'Message' -f -a myTag otherBranch

Now a `git show myOtherTag` gives me the old myTag - and labels it as
myTag. Copy and pasting this directs me to somewhere completely else,
though. Wouldn't it be the more sane approach here to fail, when the old
tag is (or as in your example will) still be referenced? Or make some
effort with git show that it is clear that the referenced tag can no
longer be referenced with its original name?

Greetings,
Eckhard