summaryrefslogtreecommitdiff
path: root/build-aux
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2012-07-06 15:51:05 +0200
committerAndy Wingo <wingo@pobox.com>2012-07-06 16:08:25 +0200
commitded42750d65cf976b8ff2874fcca5de91b2526cb (patch)
tree161733dadb5681799f59e5b083a3db20f467702a /build-aux
parent826ce16e29822ed062b7f97a9b2ab3c589134b7c (diff)
git-version-gen: add --match argument
* build-aux/git-version-gen (Options): Add --match argument. (v_from_git): Remove path without --match.
Diffstat (limited to 'build-aux')
-rwxr-xr-xbuild-aux/git-version-gen19
1 files changed, 12 insertions, 7 deletions
diff --git a/build-aux/git-version-gen b/build-aux/git-version-gen
index 0fa90636b..0b5115443 100755
--- a/build-aux/git-version-gen
+++ b/build-aux/git-version-gen
@@ -1,6 +1,6 @@
#!/bin/sh
# Print a version string.
-scriptversion=2012-03-18.17; # UTC
+scriptversion=2012-07-06.14; # UTC
# Copyright (C) 2007-2012 Free Software Foundation, Inc.
#
@@ -85,20 +85,25 @@ Print a version string.
Options:
- --prefix prefix of git tags (default 'v')
+ --prefix prefix of git tags to strip from version (default 'v')
+ --match pattern for git tags to match (default: '\$prefix*')
- --help display this help and exit
- --version output version information and exit
+ --help display this help and exit
+ --version output version information and exit
-Running without arguments will suffice in most cases."
+Running without arguments will suffice in most cases. If no --match
+argument is given, only match tags that begin with the --prefix."
prefix=v
+unset match
+unset tag_sed_script
while test $# -gt 0; do
case $1 in
--help) echo "$usage"; exit 0;;
--version) echo "$version"; exit 0;;
--prefix) shift; prefix="$1";;
+ --match) shift; match="$1";;
-*)
echo "$0: Unknown option '$1'." >&2
echo "$0: Try '--help' for more information." >&2
@@ -121,6 +126,7 @@ if test -z "$tarball_version_file"; then
exit 1
fi
+match="${match:-$prefix*}"
tag_sed_script="${tag_sed_script:-s/x/x/}"
nl='
@@ -151,8 +157,7 @@ then
# directory, and "git describe" output looks sensible, use that to
# derive a version string.
elif test "`git log -1 --pretty=format:x . 2>&1`" = x \
- && v=`git describe --abbrev=4 --match="$prefix*" HEAD 2>/dev/null \
- || git describe --abbrev=4 HEAD 2>/dev/null` \
+ && v=`git describe --abbrev=4 --match="$match" HEAD 2>/dev/null` \
&& v=`printf '%s\n' "$v" | sed "$tag_sed_script"` \
&& case $v in
$prefix[0-9]*) ;;