bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

git-version-gen improvement


From: Eric Blake
Subject: git-version-gen improvement
Date: Tue, 8 Apr 2008 17:25:16 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

I'm checking this in.  It makes conditional use of a new feature added to 'git 
describe' in git 1.5.5 to filter the list of interesting tag names (based in 
part on a suggestion I made a while ago:
http://thread.gmane.org/gmane.comp.version-control.git/68120).  I also tested 
with git 1.5.4 to make sure that 'git describe --match' fails and is silent on 
stdout when --match is not understood.

For example, with the master branch of the M4 repository, I want git-version-
gen to base versions off of the older tag 'v1.9a':
http://git.sv.gnu.org/gitweb/?p=m4.git;a=tag;h=b6c4ff3
even though I have a more recent annotated tag 'cvs-readonly':
http://git.sv.gnu.org/gitweb/?p=m4.git;a=tag;h=41db854


>From c7fd31e92f7f87518409722e13b765a795eefdb0 Mon Sep 17 00:00:00 2001
From: Eric Blake <address@hidden>
Date: Tue, 8 Apr 2008 07:38:18 -0600
Subject: [PATCH] Use 'git describe --match' if present (added in git 1.5.5).

* build-aux/git-version-gen: Limit result to tags that match 'v*'
if possible.

Signed-off-by: Eric Blake <address@hidden>
---
 ChangeLog                 |    6 ++++++
 build-aux/git-version-gen |    5 +++--
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index db6db0f..bd8cfa0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2008-04-08  Eric Blake  <address@hidden>
+
+       Use 'git describe --match' if present (added in git 1.5.5).
+       * build-aux/git-version-gen: Limit result to tags that match 'v*'
+       if possible.
+
 2008-04-06  Jim Meyering  <address@hidden>
 
        * gnulib-tool (func_add_or_update): s/backuped/backed up/ in diagnostic
diff --git a/build-aux/git-version-gen b/build-aux/git-version-gen
index 7aa0253..710870c 100755
--- a/build-aux/git-version-gen
+++ b/build-aux/git-version-gen
@@ -1,6 +1,6 @@
 #!/bin/sh
 # Print a version string.
-scriptversion=2008-04-03.22
+scriptversion=2008-04-08.07
 
 # Copyright (C) 2007-2008 Free Software Foundation
 #
@@ -95,7 +95,8 @@ if test -n "$v"
 then
     : # use $v
 elif test -d .git \
-    && v=`git describe --abbrev=4 HEAD 2>/dev/null` \
+    && v=`git describe --abbrev=4 --match='v*' HEAD 2>/dev/null \
+         || git describe --abbrev=4 HEAD 2>/dev/null` \
     && case $v in
         v[0-9]*) ;;
         *) (exit 1) ;;
-- 
1.5.5.rc3.13.ga1c0







reply via email to

[Prev in Thread] Current Thread [Next in Thread]