changeset 9719:ec87f62b97b8

Enable use of older two part flavor 'git describe'. * build-aux/git-version-gen: If using the older two part flavor of git version then recreate the third part now present in the newer three part flavor of git describe.
author Bob Proulx <bob@proulx.com>
date Thu, 21 Feb 2008 09:07:10 +0100
parents 5954dae30c7f
children 46b3aff8518a
files ChangeLog build-aux/git-version-gen
diffstat 2 files changed, 24 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2008-02-20  Bob Proulx  <bob@proulx.com>
+
+	Enable use of older two part flavor 'git describe'.
+	* build-aux/git-version-gen: If using the older two part flavor of
+	git version then recreate the third part now present in the
+	newer three part flavor of git describe.
+
 2008-02-20  Martin Buchholz  <martin@xemacs.org>  (tiny change)
 
 	* lib/fts.c (fts_build): Typo correction to comment.
--- a/build-aux/git-version-gen
+++ b/build-aux/git-version-gen
@@ -59,6 +59,23 @@
 	 *) (exit 1) ;;
        esac
 then
+    # Is this a new git that lists number of commits since the last
+    # tag or the previous older version that did not?
+    #   Newer: v6.10-77-g0f8faeb
+    #   Older: v6.10-g0f8faeb
+    case $v in
+	*-*-*) : git describe is okay three part flavor ;;
+	*-*)
+	    : git describe is older two part flavor
+	    # Recreate the number of commits and rewrite such that the
+	    # result is the same as if we were using the newer version
+	    # of git describe.
+	    vtag=`echo "$v" | sed 's/-.*//'`
+	    numcommits=`git rev-list "$vtag"..HEAD | wc -l`
+	    v=`echo "$v" | sed "s/\(.*\)-\(.*\)/\1-$numcommits-\2/"`;
+	    ;;
+    esac
+
     # Change the first '-' to a '.', so version-comparing tools work properly.
     # Remove the "g" in git describe's output string, to save a byte.
     v=`echo "$v" | sed 's/-/./;s/\(.*\)-g/\1-/'`;