git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Bryan Turner <bturner@atlassian.com>
To: Amiel Elboim <amielel@matrix.co.il>
Cc: "git@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: Fw: git describe issue
Date: Tue, 2 Apr 2019 23:59:15 -0700	[thread overview]
Message-ID: <CAGyf7-HUAoYURDnnp+nq+4EQkysoTE+f_WK8cEVPCHP065rv6A@mail.gmail.com> (raw)
In-Reply-To: <AM6PR08MB4199B076CB886AE814AFF4528D570@AM6PR08MB4199.eurprd08.prod.outlook.com>

On Tue, Apr 2, 2019 at 11:47 PM Amiel Elboim <amielel@matrix.co.il> wrote:
> Hi!
>
> I've found strange behavior with 'git describe' command, look like for me as bug.
>
> In the case I create 2 tags on same commit and I run 'git describe --tags' I expect to get the latest tag, but always I get the first tag I created on the commit.
>
> Unlike git-describe documentations - "The command finds the most recent tag that is reachable from a commit. "
>
> Simple example -
>
> amiel@CLINIKALDEV10:~/Xpress$ git tag v1
> amiel@CLINIKALDEV10:~/Xpress$ git tag v2
> amiel@CLINIKALDEV10:~/Xpress$ git describe --tags
> v1

With this example, Git has no way to know which tag is "newer".
They're lightweight tags, which means they have no metadata of their
own; they just tag a commit. That means, as far as "age" goes, they're
both the same because their age is drawn from the tagged commit, which
is the same for both. (Since tag names are entirely free-form, I'm not
sure Git makes any effort to try and parse them to "guess" which is
newer; that seems like a Sisyphean task to me.)

If you run this with annotated tags, you get different output (at
least on Git 2.20.1, what I happened to have installed; you never
mentioned your Git version)
incom@Jael MINGW64 /c/Temp/first.git (BARE:master)
$ git tag -a v1
incom@Jael MINGW64 /c/Temp/first.git (BARE:master)
$ git tag -a v2
incom@Jael MINGW64 /c/Temp/first.git (BARE:master)
$ git describe --tags
v2

Hope this helps!
Bryan

  reply	other threads:[~2019-04-03  6:59 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <AM6PR08MB41993844F57794DDF4B33B8F8D570@AM6PR08MB4199.eurprd08.prod.outlook.com>
2019-04-03  6:47 ` Fw: git describe issue Amiel Elboim
2019-04-03  6:59   ` Bryan Turner [this message]
     [not found]     ` <AM6PR08MB4199EE3834CBF84D28244D9E8D570@AM6PR08MB4199.eurprd08.prod.outlook.com>
2019-04-03  8:11       ` Bryan Turner
2019-04-03  9:19         ` Philip Oakley

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=CAGyf7-HUAoYURDnnp+nq+4EQkysoTE+f_WK8cEVPCHP065rv6A@mail.gmail.com \
    --to=bturner@atlassian.com \
    --cc=amielel@matrix.co.il \
    --cc=git@vger.kernel.org \
    /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).