git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Matheus Tavares Bernardino <matheus.bernardino@usp.br>
To: Roland Hieber <rhi@pengutronix.de>
Cc: git <git@vger.kernel.org>
Subject: Re: git-describe --tags warning: 'X' is really 'Y' here
Date: Wed, 5 Feb 2020 14:15:07 -0300	[thread overview]
Message-ID: <CAHd-oW6p-zs-SZnQsJNWPGE8-Ls3vXvf_HOeO+W=1PsQ_oihZA@mail.gmail.com> (raw)
In-Reply-To: <20200205141332.lov2f2fvinehcd3a@pengutronix.de>

On Wed, Feb 5, 2020 at 11:13 AM Roland Hieber <rhi@pengutronix.de> wrote:
>
> Hi,

Hi, Roland

> I'm working with the GCC Git repo [0] (which was apparently recently
> converted from SVN [1]), and I'm trying to find out the most recent tag.
> So on the master branch I do:
>
>     gcc (master) $ git describe --tags --abbrev=0
>     warning: tag 'gcc_9_2_0_release' is really 'releases/gcc-9.2.0' here
>     gcc_9_2_0_release
>
> It took me a while to find out what the warning means, because
> 'gcc_9_2_0_release' is not in $(git tag -l), and it cannot be used as a
> ref either:
>
>     gcc (master) $ git show gcc_9_2_0_release
>     fatal: ambiguous argument 'gcc_9_2_0_release': unknown revision or path not in the working tree.
>     Use '--' to separate paths from revisions, like this:
>     'git <command> [<revision>...] -- [<file>...]'
>
> That name is in the tag itself:
>
>     gcc (master) $ git show releases/gcc-9.2.0 | head -n3
>     tag gcc_9_2_0_release
>     Tagger: Jakub Jelinek <jakub@gcc.gnu.org>
>     Date:   2019-08-12 09:38:59

It seems that the commit which added the output message you got is
212945d ("Teach git-describe to verify annotated tag names before
output", 2008-02-28) [1]. As the commit message states, the warning is
emitted when a tag is locally stored under a different name from the
one it was originally created (being the former the one you will want
to use at `git show`).

A simple way to replicate what you experienced in a fresh repo is with:

$ git tag -am "testing tag body" testing-tag
$ mv .git/refs/tags/testing-tag .git/refs/tags/testing-tag-with-new-name
$ git describe --tags --abbrev=0

Which outputs:

warning: tag 'testing-tag' is really 'testing-tag-with-new-name' here
testing-tag

And in fact, if we take a look at the tag with hash `dbb1e12` in GCC's
repo (using `git cat-file -p dbb1e12`) we see that the tag was
originally created with the name "gcc_9_2_0_release" (that is the name
stored in the tag object body). But the reference was later renamed,
since, in the `.git/packed-refs` file, we find the said hash
associated with "refs/tags/releases/gcc-9.2.0". I think that is what
`git tag` is warning you about.

> So my question is: is it the intended behaviour of 'git-describe --tags'
> that it outputs tag names that cannot be used as a ref? If so, what is a
> good other way to find out the most recent tag?
>

Hm, other than using the name provided in the warning, I don't know
about a more 'direct' way. But I'm not very used to `git describe`s
code, probably others can suggest a better option :)

---
Matheus

[1]: https://github.com/git/git/commit/212945d4a85dfa172ea55ec73b1d830ef2d8582f

  reply	other threads:[~2020-02-05 17:15 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-05 14:13 git-describe --tags warning: 'X' is really 'Y' here Roland Hieber
2020-02-05 17:15 ` Matheus Tavares Bernardino [this message]
2020-02-14  6:53   ` Jeff King
2020-02-14 16:57     ` Junio C Hamano
2020-02-15 21:34       ` [PATCH] describe: output tag's ref instead of embedded name Matheus Tavares
2020-02-16  6:51         ` Jeff King
2020-02-18 19:31           ` Junio C Hamano
2020-02-18 19:54             ` Jeff King
2020-02-18 23:05               ` Junio C Hamano
2020-02-18 23:28                 ` Junio C Hamano
2020-02-19  1:57                   ` Jeff King
2020-02-19  3:22                     ` Junio C Hamano
2020-02-19  3:56                       ` Jeff King
2020-02-19 11:14                         ` Junio C Hamano
2020-02-20 11:25                           ` Jeff King
2020-02-20 17:34                             ` Junio C Hamano
2020-02-20 22:19                               ` Matheus Tavares Bernardino
2020-02-20 22:59                                 ` Junio C Hamano
2020-02-21  1:33                                   ` Matheus Tavares
2020-02-21  2:05                                     ` Junio C Hamano
2020-02-21  6:00                                       ` Jeff King
2020-02-21  5:58                               ` Jeff King
2020-02-19 10:08                       ` Roland Hieber

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAHd-oW6p-zs-SZnQsJNWPGE8-Ls3vXvf_HOeO+W=1PsQ_oihZA@mail.gmail.com' \
    --to=matheus.bernardino@usp.br \
    --cc=git@vger.kernel.org \
    --cc=rhi@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).