Re: Fw: git describe issue

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Apr 2, 2019 at 11:47 PM Amiel Elboim <amielel@xxxxxxxxxxxx> 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



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux