* Fw: git describe issue [not found] <AM6PR08MB41993844F57794DDF4B33B8F8D570@AM6PR08MB4199.eurprd08.prod.outlook.com> @ 2019-04-03 6:47 ` Amiel Elboim 2019-04-03 6:59 ` Bryan Turner 0 siblings, 1 reply; 4+ messages in thread From: Amiel Elboim @ 2019-04-03 6:47 UTC (permalink / raw) To: git@vger.kernel.org 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 amiel@CLINIKALDEV10:~/Xpress$ gl * 4f54749 (HEAD -> master, tag: v2, tag: v1, origin/master, origin/HEAD) start point with git I'll happy to know if is bug or I don't understand something. Thanks Amiel ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Fw: git describe issue 2019-04-03 6:47 ` Fw: git describe issue Amiel Elboim @ 2019-04-03 6:59 ` Bryan Turner [not found] ` <AM6PR08MB4199EE3834CBF84D28244D9E8D570@AM6PR08MB4199.eurprd08.prod.outlook.com> 0 siblings, 1 reply; 4+ messages in thread From: Bryan Turner @ 2019-04-03 6:59 UTC (permalink / raw) To: Amiel Elboim; +Cc: git@vger.kernel.org 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 ^ permalink raw reply [flat|nested] 4+ messages in thread
[parent not found: <AM6PR08MB4199EE3834CBF84D28244D9E8D570@AM6PR08MB4199.eurprd08.prod.outlook.com>]
* Re: Fw: git describe issue [not found] ` <AM6PR08MB4199EE3834CBF84D28244D9E8D570@AM6PR08MB4199.eurprd08.prod.outlook.com> @ 2019-04-03 8:11 ` Bryan Turner 2019-04-03 9:19 ` Philip Oakley 0 siblings, 1 reply; 4+ messages in thread From: Bryan Turner @ 2019-04-03 8:11 UTC (permalink / raw) To: Amiel Elboim; +Cc: Git Users On Wed, Apr 3, 2019 at 1:00 AM Amiel Elboim <amielel@matrix.co.il> wrote: > > Very helpful! annotated tag is good solution for us. > > However fix of this issue is important, because it's confusing when you want to track on your version using git tags. Lightweight tags have no metadata to allow for ordering, so I'm not sure there's something to "fix" here. Given the tags have identical timestamps, Git simply displays the one that's first alphabetically. Git does have some ability to parse versions and sort them, on newer versions, but there's no way to activate that via "git describe --tags", at least as far as I'm aware (and I'm not sure how reliable it can be, given tag names are essentially free-form text). You can try Git's version sorting with a command like "git tag --sort=-v:refname" (The "-" before "v:refname" sorts in descending order) incom@Jael MINGW64 /c/Temp/fourth.git (BARE:master) $ git tag v1 v2 incom@Jael MINGW64 /c/Temp/fourth.git (BARE:master) $ git tag --sort=-v:refname v2 v1 Since you can't enable that for "git describe --tags", though, I'm not sure it's helpful. (Someone else can correct me if there is a way to make "git describe" do that.) Bryan (Re-added the list on CC) ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Fw: git describe issue 2019-04-03 8:11 ` Bryan Turner @ 2019-04-03 9:19 ` Philip Oakley 0 siblings, 0 replies; 4+ messages in thread From: Philip Oakley @ 2019-04-03 9:19 UTC (permalink / raw) To: Bryan Turner, Amiel Elboim; +Cc: Git Users On 03/04/2019 09:11, Bryan Turner wrote: > On Wed, Apr 3, 2019 at 1:00 AM Amiel Elboim <amielel@matrix.co.il> wrote: >> Very helpful! annotated tag is good solution for us. >> >> However fix of this issue is important, because it's confusing when you want to track on your version using git tags. > Lightweight tags have no metadata to allow for ordering, so I'm not > sure there's something to "fix" here. wouldn't the 'fix' be to the documentation that Amiel quoted to clarify that 'annotated tags' can be date sorted but lightweight tags can't. Maybe Amiel could suggest a short documentation patch to that effect that would have helped as a new reader of that doc. In this case it's the omission that is easily missed. > Given the tags have identical > timestamps, Git simply displays the one that's first alphabetically. > > Git does have some ability to parse versions and sort them, on newer > versions, but there's no way to activate that via "git describe > --tags", at least as far as I'm aware (and I'm not sure how reliable > it can be, given tag names are essentially free-form text). > > You can try Git's version sorting with a command like "git tag > --sort=-v:refname" (The "-" before "v:refname" sorts in descending > order) > > incom@Jael MINGW64 /c/Temp/fourth.git (BARE:master) > $ git tag > v1 > v2 > incom@Jael MINGW64 /c/Temp/fourth.git (BARE:master) > $ git tag --sort=-v:refname > v2 > v1 > > Since you can't enable that for "git describe --tags", though, I'm not > sure it's helpful. (Someone else can correct me if there is a way to > make "git describe" do that.) > > Bryan > > (Re-added the list on CC) Philip ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-04-03 9:19 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[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
[not found] ` <AM6PR08MB4199EE3834CBF84D28244D9E8D570@AM6PR08MB4199.eurprd08.prod.outlook.com>
2019-04-03 8:11 ` Bryan Turner
2019-04-03 9:19 ` Philip Oakley
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 NNTP newsgroup(s).