summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2007-11-05 08:27:07 +0100
committerJim Meyering <meyering@redhat.com>2007-11-05 08:27:07 +0100
commit0f6573c5dde9f02967f7fa0ad4da54ff911c3abe (patch)
tree1a7709ada36bcacb6e8e6e6c202c71afd4ef776b
parent325ed42ed207a6526ec5055d81cf08e7f74afb53 (diff)
downloadgnulib-0f6573c5dde9f02967f7fa0ad4da54ff911c3abe.tar.gz
git-version-gen: sync from coreutils.
* build-aux/git-version-gen: Add comments. Change the first '-' to '.' in the snapshot version string, e.g., 6.9-377-08144 -> 6.9.377-08144 Remove first parameter. Don't declare a version "-dirty" merely because a time stamp has changed.
-rw-r--r--ChangeLog10
-rwxr-xr-xbuild-aux/git-version-gen27
2 files changed, 28 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index ae2faa6c93..66e77a1305 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2007-11-05 Jim Meyering <meyering@redhat.com>
+
+ git-version-gen: sync from coreutils.
+ * build-aux/git-version-gen: Add comments.
+ Change the first '-' to '.' in the snapshot version string,
+ e.g., 6.9-377-08144 -> 6.9.377-08144
+ Remove first parameter.
+ Don't declare a version "-dirty" merely because a time
+ stamp has changed.
+
2007-11-04 Bruno Haible <bruno@clisp.org>
* lib/lock.h: Protect all macro definitions containing an 'if'
diff --git a/build-aux/git-version-gen b/build-aux/git-version-gen
index 5701dcf8b8..67ed3ea286 100755
--- a/build-aux/git-version-gen
+++ b/build-aux/git-version-gen
@@ -1,7 +1,6 @@
#!/bin/sh
# Print a version string.
-# This script is derived from GIT-VERSION-GEN from GIT: http://git.or.cz/.
-scriptversion=2007-06-30.12
+scriptversion=2007-11-05.08
# Copyright (C) 2007 Free Software Foundation
#
@@ -20,13 +19,19 @@ scriptversion=2007-06-30.12
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
+# This script is derived from GIT-VERSION-GEN from GIT: http://git.or.cz/.
+# It may be run two ways:
+# - from a git repository in which the git-describe command below
+# produces useful output (thus requiring at least one signed tag)
+# - from a non-git-repo directory containing a .version file, which
+# presumes this script is invoked like "./git-version-gen .version".
+
case $# in
- 2) ;;
- *) echo 1>&2 "Usage: $0 \$VERSION \$srcdir/.version"; exit 1;;
+ 1) ;;
+ *) echo 1>&2 "Usage: $0 \$srcdir/.version"; exit 1;;
esac
-default_version=$1
-tarball_version_file=$2
+tarball_version_file=$1
nl='
'
@@ -54,14 +59,18 @@ elif test -d .git \
*) (exit 1) ;;
esac
then
- # Remove the "g" in git-describe's output string; change each - to a '.'
- v=`echo "$v" | sed 's/\(.*\)-g/\1-/;s/-/./g'`;
+ # 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-/'`;
else
- v=$default_version
+ v=UNKNOWN
fi
v=`echo "$v" |sed 's/^v//'`
+# Don't declare a version "dirty" merely because a time stamp has changed.
+git-status > /dev/null 2>&1
+
dirty=`sh -c 'git diff-index --name-only HEAD' 2>/dev/null` || dirty=
case "$dirty" in
'') ;;