Teach git-describe to verify annotated tag names before output
If an annotated tag describes a commit we want to favor the name
listed in the body of the tag, rather than whatever name it has
been stored under locally. By doing so it is easier to converse
about tags with others, even if the tags happen to be fetched to
a different name than it was given by its creator.
To avoid confusion when a tag is stored under a different name
(and thus is not readable via git-rev-parse --verify, etc.) we show
a warning message if the name of the tag does not match the ref
we found it under and if that tag was also selected for output.
For example:
$ git tag -a -m "i am a test" testtag
$ mv .git/refs/tags/testtag .git/refs/tags/bobbytag
$ ./git-describe HEAD
warning: tag 'testtag' is really 'bobbytag' here
testtag
$ git tag -d testtag
error: tag 'testtag' not found.
$ git tag -d bobbytag
Deleted tag 'bobbytag'
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>