Re: Add a "git-describe" command

From: Linus Torvalds <torvalds@osdl.org>
Date: 2005-12-25 09:13:25
On Sat, 24 Dec 2005, Linus Torvalds wrote:
> 
> This is useful for two things:
> 
>  - automatic version naming in Makefiles, for example. We could use it in 
>    git itself: when doing "git --version", we could use this to give a 
>    much more useful description of exactly what version was installed.

This trivial patch fails to do that correctly, but maybe somebody could 
fix it. 

The problem is not that it generates GIT_VERSION wrong. The problem is 
two-fold:
 - it should notice when "git-describe" doesn't exist, and fall back on 
   the old less-than-descriptive behaviour
 - it doesn't do dependencies correctly (ie it should now make "git" 
   depend on the version number, but it doesn't, so it doesn't re-build 
   git after a commit/pull)

but at least it shows the _idea_ of using git-describe.

With this I get

	[torvalds@g5 git]$ git --version
	git version v1.0.4-g6e9961d6

which I think is better than "1.0.GIT" which doesn't say anything about 
what the _actual_ version was.

(Ignore the particular SHA1 hash - it has my local commit that you can't 
re-create that just created that git-describe thing. You'll get your own 
version number).

		Linus

---
diff --git a/Makefile b/Makefile
index 47e7898..2e5c569 100644
--- a/Makefile
+++ b/Makefile
@@ -55,7 +55,7 @@ all:
 # Define USE_STDEV below if you want git to care about the underlying device
 # change being considered an inode change from the update-cache perspective.
 
-GIT_VERSION = 1.0.GIT
+GIT_VERSION = $(shell git-describe HEAD | sed 's:refs/tags/::')
 
 # CFLAGS and LDFLAGS are for the users to override from the command line.
 
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Received on Sun Dec 25 09:14:08 2005

This archive was generated by hypermail 2.1.8 : 2005-12-25 09:14:15 EST