summaryrefslogtreecommitdiff
path: root/gnulib-local/build-aux/git-version-gen.diff
blob: 8451701d5148a6240814466ab1f996fb43679035 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
This patch is being discussed
at <http://lists.gnu.org/archive/html/bug-gnulib/2012-07/msg00079.html>.
Remove when integrated in Gnulib.

diff --git a/build-aux/git-version-gen b/build-aux/git-version-gen
index bd2c4b6..4458d7d 100755
--- a/build-aux/git-version-gen
+++ b/build-aux/git-version-gen
@@ -86,6 +86,7 @@ Print a version string.
 Options:
 
    --prefix PREFIX    prefix of git tags (default 'v')
+   --match            pattern for git tags to match (default: '\$prefix*')
    --fallback VERSION
                       fallback version to use if \"git --version\" fails
 
@@ -97,11 +98,15 @@ Running without arguments will suffice in most cases."
 prefix=v
 fallback=
 
+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";;
     --fallback) shift; fallback=${1?};;
     -*)
       echo "$0: Unknown option '$1'." >&2
@@ -125,6 +130,7 @@ if test "x$tarball_version_file" = x; then
     exit 1
 fi
 
+match="${match:-$prefix*}"
 tag_sed_script="${tag_sed_script:-s/x/x/}"
 
 nl='
@@ -155,7 +161,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 \
+    && v=`git describe --abbrev=4 --match="$match" HEAD 2>/dev/null \
           || git describe --abbrev=4 HEAD 2>/dev/null` \
     && v=`printf '%s\n' "$v" | sed "$tag_sed_script"` \
     && case $v in