git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@osdl.org>
To: Junio C Hamano <junkio@cox.net>, Git Mailing List <git@vger.kernel.org>
Subject: Re: Add a "git-describe" command
Date: Sat, 24 Dec 2005 14:13:25 -0800 (PST)	[thread overview]
Message-ID: <Pine.LNX.4.64.0512241409300.14098@g5.osdl.org> (raw)
In-Reply-To: <Pine.LNX.4.64.0512241339120.14098@g5.osdl.org>



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.
 

  reply	other threads:[~2005-12-24 22:13 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-24 21:50 Add a "git-describe" command Linus Torvalds
2005-12-24 22:13 ` Linus Torvalds [this message]
2005-12-25 19:21   ` M_
2005-12-28  0:42   ` Junio C Hamano
2005-12-28  2:05     ` Johannes Schindelin
2005-12-28  0:42   ` [PATCH 1/6] git-describe: really prefer tags only Junio C Hamano
2005-12-28  0:42   ` [PATCH 2/6] git-describe: use find_unique_abbrev() Junio C Hamano
2005-12-28  0:42   ` [PATCH 3/6] git-describe: --tags and --abbrev Junio C Hamano
2005-12-28  0:42   ` [PATCH 4/6] git-describe: still prefer annotated tag under --all and --tags Junio C Hamano
2005-12-28  0:42   ` [PATCH 5/6] git-describe: documentation Junio C Hamano
2005-12-28  0:42   ` [PATCH 6/6] Makefile: use git-describe to mark the git version Junio C Hamano
2005-12-25  1:42 ` Add a "git-describe" command Junio C Hamano
2005-12-25  3:46   ` Linus Torvalds
2005-12-25  9:44     ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.64.0512241409300.14098@g5.osdl.org \
    --to=torvalds@osdl.org \
    --cc=git@vger.kernel.org \
    --cc=junkio@cox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).