{"thread":{"id":"16782","subject":"Retrieving last tag of a working tree","startedAt":"2008-12-18T12:07:19Z","lastAt":"2008-12-21T15:28:56Z","messageCount":3,"participants":["the_jack","Sitaram Chamarty","Thomas Rast"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"98247","messageId":"21071491.post@talk.nabble.com","threadId":"16782","inReplyTo":null,"subject":"Retrieving last tag of a working tree","fromName":"the_jack","fromEmail":"josip@yopmail.com","sentAt":"2008-12-18T12:07:19Z","receivedAt":"2008-12-18T12:07:19Z","isPatch":false,"sender":{"key":"josip@yopmail.com","avatar":null},"body":"\nI'm using msys git on Windows XP for version tracking embedded design project\nin C. I mostly work with GUIs (git-gui and qgit), I use bash only when I\nhave to.\n\nI need to be able to access version from software. To do that, I use tags to\nmark all released versions, and that version string is written to file\nversion.h (the file is not tracked) by pre-build command:\n\n#define KDK_SOFTWARE_VERSION \"0.72\"\n\nPrecompiler assigns this string to a variable. At this moment, version.h is\nfilled by python script that calls \"git-describe --tag HEAD\" and parses the\noutput. This works, but it's not quite reliable. There has to be a better\nway for getting the last tag of current working tree. If I checkout an\nearlier tagged version (0.70), I would need to automatically get 0.70 inside\nversion.h\n\nCan anyone shed any light on this?\n-- \nView this message in context: http://www.nabble.com/Retrieving-last-tag-of-a-working-tree-tp21071491p21071491.html\nSent from the git mailing list archive at Nabble.com.\n"},{"id":"98491","messageId":"slrngksm2t.p3b.sitaramc@sitaramc.homelinux.net","threadId":"16782","inReplyTo":"21071491.post@talk.nabble.com","subject":"Re: Retrieving last tag of a working tree","fromName":"Sitaram Chamarty","fromEmail":"sitaramc@gmail.com","sentAt":"2008-12-21T14:53:17Z","receivedAt":"2008-12-21T14:53:17Z","isPatch":false,"sender":{"key":"sitaramc@gmail.com","avatar":"https://avatars.githubusercontent.com/u/43316?v=4"},"body":"On 2008-12-18, the_jack <josip@yopmail.com> wrote:\n>\n> output. This works, but it's not quite reliable. There has to be a better\n> way for getting the last tag of current working tree. If I checkout an\n\ngit describe?\n"},{"id":"98492","messageId":"200812211628.59120.trast@student.ethz.ch","threadId":"16782","inReplyTo":"21071491.post@talk.nabble.com","subject":"Re: Retrieving last tag of a working tree","fromName":"Thomas Rast","fromEmail":"trast@student.ethz.ch","sentAt":"2008-12-21T15:28:56Z","receivedAt":"2008-12-21T15:28:56Z","isPatch":false,"sender":{"key":"tr@thomasrast.ch","avatar":"https://avatars.githubusercontent.com/u/153510?v=4"},"body":"the_jack wrote:\n> Precompiler assigns this string to a variable. At this moment, version.h is\n> filled by python script that calls \"git-describe --tag HEAD\" and parses the\n> output. This works, but it's not quite reliable. There has to be a better\n> way for getting the last tag of current working tree. If I checkout an\n> earlier tagged version (0.70), I would need to automatically get 0.70 inside\n> version.h\n\n'git describe' is indeed the tool for this.  You have not said in what\nway it fails, so here's an educated guess:\n\nUp until 7e425c4 (describe: Make --tags and --all match lightweight\ntags more often, 2008-10-13) which will only be in 1.6.1, using --tags\ndoes not match a lightweight tag if there is also an annotated tag\navailable.\n\n-Thomas\n\n-- \nThomas Rast\ntrast@{inf,student}.ethz.ch\n\n\n\n\n"}]}