{"thread":{"id":"50864","subject":"Fw: git describe issue","startedAt":"2019-04-03T06:47:40Z","lastAt":"2019-04-03T09:19:22Z","messageCount":4,"participants":["Amiel Elboim","Bryan Turner","Philip Oakley"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"373000","messageId":"AM6PR08MB4199B076CB886AE814AFF4528D570@AM6PR08MB4199.eurprd08.prod.outlook.com","threadId":"50864","inReplyTo":"AM6PR08MB41993844F57794DDF4B33B8F8D570@AM6PR08MB4199.eurprd08.prod.outlook.com","subject":"Fw: git describe issue","fromName":"Amiel Elboim","fromEmail":"amielel@matrix.co.il","sentAt":"2019-04-03T06:47:34Z","receivedAt":"2019-04-03T06:47:40Z","isPatch":false,"sender":{"key":"amielel@matrix.co.il","avatar":null},"body":"\n\nHi!\n\nI've found strange behavior with 'git describe' command, look like for me as bug. \n\nIn 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.\n\nUnlike git-describe documentations - \"The command finds the most recent tag that is reachable from a commit. \"\n\nSimple example -   \n\n\n\namiel@CLINIKALDEV10:~/Xpress$ git tag v1\namiel@CLINIKALDEV10:~/Xpress$ git tag v2\namiel@CLINIKALDEV10:~/Xpress$ git describe --tags\nv1\namiel@CLINIKALDEV10:~/Xpress$ gl\n* 4f54749 (HEAD -> master, tag: v2, tag: v1, origin/master, origin/HEAD) start point with git\n\n\n\nI'll happy to know if is bug or I don't understand something.\n\n\nThanks\n\n\nAmiel  \n\n  \n\n\n     "},{"id":"373002","messageId":"CAGyf7-HUAoYURDnnp+nq+4EQkysoTE+f_WK8cEVPCHP065rv6A@mail.gmail.com","threadId":"50864","inReplyTo":"AM6PR08MB4199B076CB886AE814AFF4528D570@AM6PR08MB4199.eurprd08.prod.outlook.com","subject":"Re: Fw: git describe issue","fromName":"Bryan Turner","fromEmail":"bturner@atlassian.com","sentAt":"2019-04-03T06:59:15Z","receivedAt":"2019-04-03T06:59:29Z","isPatch":false,"sender":{"key":"bturner@atlassian.com","avatar":"https://gravatar.com/avatar/16bcf3167981c1ef7c804e502642366d888a35b0d0b0a4ca01fdc442aa1acb1e?d=mp&s=160"},"body":"On Tue, Apr 2, 2019 at 11:47 PM Amiel Elboim <amielel@matrix.co.il> wrote:\n> Hi!\n>\n> I've found strange behavior with 'git describe' command, look like for me as bug.\n>\n> 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.\n>\n> Unlike git-describe documentations - \"The command finds the most recent tag that is reachable from a commit. \"\n>\n> Simple example -\n>\n> amiel@CLINIKALDEV10:~/Xpress$ git tag v1\n> amiel@CLINIKALDEV10:~/Xpress$ git tag v2\n> amiel@CLINIKALDEV10:~/Xpress$ git describe --tags\n> v1\n\nWith this example, Git has no way to know which tag is \"newer\".\nThey're lightweight tags, which means they have no metadata of their\nown; they just tag a commit. That means, as far as \"age\" goes, they're\nboth the same because their age is drawn from the tagged commit, which\nis the same for both. (Since tag names are entirely free-form, I'm not\nsure Git makes any effort to try and parse them to \"guess\" which is\nnewer; that seems like a Sisyphean task to me.)\n\nIf you run this with annotated tags, you get different output (at\nleast on Git 2.20.1, what I happened to have installed; you never\nmentioned your Git version)\nincom@Jael MINGW64 /c/Temp/first.git (BARE:master)\n$ git tag -a v1\nincom@Jael MINGW64 /c/Temp/first.git (BARE:master)\n$ git tag -a v2\nincom@Jael MINGW64 /c/Temp/first.git (BARE:master)\n$ git describe --tags\nv2\n\nHope this helps!\nBryan\n"},{"id":"373008","messageId":"CAGyf7-GcrWX-TRP89a1SqKu4h74Mbezq0ifHpS305epfmKxJvw@mail.gmail.com","threadId":"50864","inReplyTo":"AM6PR08MB4199EE3834CBF84D28244D9E8D570@AM6PR08MB4199.eurprd08.prod.outlook.com","subject":"Re: Fw: git describe issue","fromName":"Bryan Turner","fromEmail":"bturner@atlassian.com","sentAt":"2019-04-03T08:11:50Z","receivedAt":"2019-04-03T08:12:03Z","isPatch":false,"sender":{"key":"bturner@atlassian.com","avatar":"https://gravatar.com/avatar/16bcf3167981c1ef7c804e502642366d888a35b0d0b0a4ca01fdc442aa1acb1e?d=mp&s=160"},"body":"On Wed, Apr 3, 2019 at 1:00 AM Amiel Elboim <amielel@matrix.co.il> wrote:\n>\n> Very helpful!  annotated tag is good solution for us.\n>\n> However fix of this issue is important, because it's confusing when you want to track on your version using git tags.\n\nLightweight tags have no metadata to allow for ordering, so I'm not\nsure there's something to \"fix\" here. Given the tags have identical\ntimestamps, Git simply displays the one that's first alphabetically.\n\nGit does have some ability to parse versions and sort them, on newer\nversions, but there's no way to activate that via \"git describe\n--tags\", at least as far as I'm aware (and I'm not sure how reliable\nit can be, given tag names are essentially free-form text).\n\nYou can try Git's version sorting with a command like \"git tag\n--sort=-v:refname\" (The \"-\" before \"v:refname\" sorts in descending\norder)\n\nincom@Jael MINGW64 /c/Temp/fourth.git (BARE:master)\n$ git tag\nv1\nv2\nincom@Jael MINGW64 /c/Temp/fourth.git (BARE:master)\n$ git tag --sort=-v:refname\nv2\nv1\n\nSince you can't enable that for \"git describe --tags\", though, I'm not\nsure it's helpful. (Someone else can correct me if there is a way to\nmake \"git describe\" do that.)\n\nBryan\n\n(Re-added the list on CC)\n"},{"id":"373011","messageId":"16a9780d-9c3e-673a-4567-f0c4d93f88bc@iee.org","threadId":"50864","inReplyTo":"CAGyf7-GcrWX-TRP89a1SqKu4h74Mbezq0ifHpS305epfmKxJvw@mail.gmail.com","subject":"Re: Fw: git describe issue","fromName":"Philip Oakley","fromEmail":"philipoakley@iee.org","sentAt":"2019-04-03T09:19:18Z","receivedAt":"2019-04-03T09:19:22Z","isPatch":false,"sender":{"key":"philipoakley@iee.email","avatar":"https://avatars.githubusercontent.com/u/914343?v=4"},"body":"On 03/04/2019 09:11, Bryan Turner wrote:\n> On Wed, Apr 3, 2019 at 1:00 AM Amiel Elboim <amielel@matrix.co.il> wrote:\n>> Very helpful!  annotated tag is good solution for us.\n>>\n>> However fix of this issue is important, because it's confusing when you want to track on your version using git tags.\n> Lightweight tags have no metadata to allow for ordering, so I'm not\n> sure there's something to \"fix\" here.\nwouldn't the 'fix'  be to the documentation that Amiel quoted to clarify \nthat 'annotated tags' can be date sorted but lightweight tags can't.\n\nMaybe Amiel could suggest a short documentation patch to that effect \nthat would have helped as a new reader of that doc. In this case it's \nthe omission that is easily missed.\n\n>   Given the tags have identical\n> timestamps, Git simply displays the one that's first alphabetically.\n>\n> Git does have some ability to parse versions and sort them, on newer\n> versions, but there's no way to activate that via \"git describe\n> --tags\", at least as far as I'm aware (and I'm not sure how reliable\n> it can be, given tag names are essentially free-form text).\n>\n> You can try Git's version sorting with a command like \"git tag\n> --sort=-v:refname\" (The \"-\" before \"v:refname\" sorts in descending\n> order)\n>\n> incom@Jael MINGW64 /c/Temp/fourth.git (BARE:master)\n> $ git tag\n> v1\n> v2\n> incom@Jael MINGW64 /c/Temp/fourth.git (BARE:master)\n> $ git tag --sort=-v:refname\n> v2\n> v1\n>\n> Since you can't enable that for \"git describe --tags\", though, I'm not\n> sure it's helpful. (Someone else can correct me if there is a way to\n> make \"git describe\" do that.)\n>\n> Bryan\n>\n> (Re-added the list on CC)\nPhilip\n\n"}]}