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 | ||
af07e104 AW |
5 | --- a/build-aux/git-version-gen |
6 | +++ b/build-aux/git-version-gen | |
7 | @@ -86,6 +86,7 @@ Print a version string. | |
7e0ee59c LC |
8 | Options: |
9 | ||
af07e104 AW |
10 | --prefix prefix of git tags (default 'v') |
11 | + --match pattern for git tags to match (default: '\$prefix*') | |
12 | --fallback fallback version to use if \"git --version\" fails | |
7e0ee59c | 13 | |
af07e104 AW |
14 | --help display this help and exit |
15 | @@ -96,11 +97,15 @@ Running without arguments will suffice in most cases." | |
7e0ee59c | 16 | prefix=v |
af07e104 AW |
17 | fallback= |
18 | ||
7e0ee59c LC |
19 | +unset match |
20 | +unset tag_sed_script | |
af07e104 | 21 | + |
7e0ee59c LC |
22 | while test $# -gt 0; do |
23 | case $1 in | |
24 | --help) echo "$usage"; exit 0;; | |
25 | --version) echo "$version"; exit 0;; | |
26 | --prefix) shift; prefix="$1";; | |
27 | + --match) shift; match="$1";; | |
af07e104 | 28 | --fallback) shift; fallback="$1";; |
7e0ee59c LC |
29 | -*) |
30 | echo "$0: Unknown option '$1'." >&2 | |
af07e104 | 31 | @@ -124,6 +129,7 @@ if test "x$tarball_version_file" = x; then |
7e0ee59c LC |
32 | exit 1 |
33 | fi | |
34 | ||
35 | +match="${match:-$prefix*}" | |
36 | tag_sed_script="${tag_sed_script:-s/x/x/}" | |
37 | ||
38 | nl=' | |
af07e104 | 39 | @@ -154,7 +160,7 @@ then |
7e0ee59c LC |
40 | # directory, and "git describe" output looks sensible, use that to |
41 | # derive a version string. | |
42 | elif test "`git log -1 --pretty=format:x . 2>&1`" = x \ | |
43 | - && v=`git describe --abbrev=4 --match="$prefix*" HEAD 2>/dev/null \ | |
af07e104 AW |
44 | + && v=`git describe --abbrev=4 --match="$match" HEAD 2>/dev/null \ |
45 | || git describe --abbrev=4 HEAD 2>/dev/null` \ | |
7e0ee59c LC |
46 | && v=`printf '%s\n' "$v" | sed "$tag_sed_script"` \ |
47 | && case $v in |