git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Retrieving last tag of a working tree
@ 2008-12-18 12:07 the_jack
  2008-12-21 14:53 ` Sitaram Chamarty
  2008-12-21 15:28 ` Thomas Rast
  0 siblings, 2 replies; 3+ messages in thread
From: the_jack @ 2008-12-18 12:07 UTC (permalink / raw)
  To: git


I'm using msys git on Windows XP for version tracking embedded design project
in C. I mostly work with GUIs (git-gui and qgit), I use bash only when I
have to.

I need to be able to access version from software. To do that, I use tags to
mark all released versions, and that version string is written to file
version.h (the file is not tracked) by pre-build command:

#define KDK_SOFTWARE_VERSION "0.72"

Precompiler assigns this string to a variable. At this moment, version.h is
filled by python script that calls "git-describe --tag HEAD" and parses the
output. This works, but it's not quite reliable. There has to be a better
way for getting the last tag of current working tree. If I checkout an
earlier tagged version (0.70), I would need to automatically get 0.70 inside
version.h

Can anyone shed any light on this?
-- 
View this message in context: http://www.nabble.com/Retrieving-last-tag-of-a-working-tree-tp21071491p21071491.html
Sent from the git mailing list archive at Nabble.com.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Retrieving last tag of a working tree
  2008-12-18 12:07 Retrieving last tag of a working tree the_jack
@ 2008-12-21 14:53 ` Sitaram Chamarty
  2008-12-21 15:28 ` Thomas Rast
  1 sibling, 0 replies; 3+ messages in thread
From: Sitaram Chamarty @ 2008-12-21 14:53 UTC (permalink / raw)
  To: git

On 2008-12-18, the_jack <josip@yopmail.com> wrote:
>
> output. This works, but it's not quite reliable. There has to be a better
> way for getting the last tag of current working tree. If I checkout an

git describe?

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Retrieving last tag of a working tree
  2008-12-18 12:07 Retrieving last tag of a working tree the_jack
  2008-12-21 14:53 ` Sitaram Chamarty
@ 2008-12-21 15:28 ` Thomas Rast
  1 sibling, 0 replies; 3+ messages in thread
From: Thomas Rast @ 2008-12-21 15:28 UTC (permalink / raw)
  To: the_jack; +Cc: git

[-- Attachment #1: Type: text/plain, Size: 828 bytes --]

the_jack wrote:
> Precompiler assigns this string to a variable. At this moment, version.h is
> filled by python script that calls "git-describe --tag HEAD" and parses the
> output. This works, but it's not quite reliable. There has to be a better
> way for getting the last tag of current working tree. If I checkout an
> earlier tagged version (0.70), I would need to automatically get 0.70 inside
> version.h

'git describe' is indeed the tool for this.  You have not said in what
way it fails, so here's an educated guess:

Up until 7e425c4 (describe: Make --tags and --all match lightweight
tags more often, 2008-10-13) which will only be in 1.6.1, using --tags
does not match a lightweight tag if there is also an annotated tag
available.

-Thomas

-- 
Thomas Rast
trast@{inf,student}.ethz.ch





[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-12-21 15:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-18 12:07 Retrieving last tag of a working tree the_jack
2008-12-21 14:53 ` Sitaram Chamarty
2008-12-21 15:28 ` Thomas Rast

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).