Commit | Line | Data |
---|---|---|
7e0ee59c LC |
1 | This patch is being discussed |
2 | at <http://lists.gnu.org/archive/html/bug-gnulib/2012-07/msg00079.html>. | |
3 | Remove when integrated in Gnulib. | |
4 | ||
5 | --- a/build-aux/git-version-gen 2012-06-12 21:25:48.000000000 +0200 | |
6 | +++ b/build-aux/git-version-gen 2012-07-07 01:52:08.000000000 +0200 | |
7 | @@ -1,6 +1,6 @@ | |
8 | #!/bin/sh | |
9 | # Print a version string. | |
10 | -scriptversion=2012-03-18.17; # UTC | |
11 | +scriptversion=2012-07-06.14; # UTC | |
12 | ||
13 | # Copyright (C) 2007-2012 Free Software Foundation, Inc. | |
14 | # | |
15 | @@ -85,20 +85,25 @@ | |
16 | ||
17 | Options: | |
18 | ||
19 | - --prefix prefix of git tags (default 'v') | |
20 | + --prefix prefix of git tags to strip from version (default 'v') | |
21 | + --match pattern for git tags to match (default: '\$prefix*') | |
22 | ||
23 | - --help display this help and exit | |
24 | - --version output version information and exit | |
25 | + --help display this help and exit | |
26 | + --version output version information and exit | |
27 | ||
28 | -Running without arguments will suffice in most cases." | |
29 | +Running without arguments will suffice in most cases. If no --match | |
30 | +argument is given, only match tags that begin with the --prefix." | |
31 | ||
32 | prefix=v | |
33 | +unset match | |
34 | +unset tag_sed_script | |
35 | ||
36 | while test $# -gt 0; do | |
37 | case $1 in | |
38 | --help) echo "$usage"; exit 0;; | |
39 | --version) echo "$version"; exit 0;; | |
40 | --prefix) shift; prefix="$1";; | |
41 | + --match) shift; match="$1";; | |
42 | -*) | |
43 | echo "$0: Unknown option '$1'." >&2 | |
44 | echo "$0: Try '--help' for more information." >&2 | |
45 | @@ -121,6 +126,7 @@ | |
46 | exit 1 | |
47 | fi | |
48 | ||
49 | +match="${match:-$prefix*}" | |
50 | tag_sed_script="${tag_sed_script:-s/x/x/}" | |
51 | ||
52 | nl=' | |
53 | @@ -151,8 +157,7 @@ | |
54 | # directory, and "git describe" output looks sensible, use that to | |
55 | # derive a version string. | |
56 | elif test "`git log -1 --pretty=format:x . 2>&1`" = x \ | |
57 | - && v=`git describe --abbrev=4 --match="$prefix*" HEAD 2>/dev/null \ | |
58 | - || git describe --abbrev=4 HEAD 2>/dev/null` \ | |
59 | + && v=`git describe --abbrev=4 --match="$match" HEAD 2>/dev/null` \ | |
60 | && v=`printf '%s\n' "$v" | sed "$tag_sed_script"` \ | |
61 | && case $v in | |
62 | $prefix[0-9]*) ;; |