| 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 |
| 6 | +++ b/build-aux/git-version-gen |
| 7 | @@ -86,6 +86,7 @@ Print a version string. |
| 8 | Options: |
| 9 | |
| 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 |
| 13 | |
| 14 | --help display this help and exit |
| 15 | @@ -96,11 +97,15 @@ Running without arguments will suffice in most cases." |
| 16 | prefix=v |
| 17 | fallback= |
| 18 | |
| 19 | +unset match |
| 20 | +unset tag_sed_script |
| 21 | + |
| 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";; |
| 28 | --fallback) shift; fallback="$1";; |
| 29 | -*) |
| 30 | echo "$0: Unknown option '$1'." >&2 |
| 31 | @@ -124,6 +129,7 @@ if test "x$tarball_version_file" = x; then |
| 32 | exit 1 |
| 33 | fi |
| 34 | |
| 35 | +match="${match:-$prefix*}" |
| 36 | tag_sed_script="${tag_sed_script:-s/x/x/}" |
| 37 | |
| 38 | nl=' |
| 39 | @@ -154,7 +160,7 @@ then |
| 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 \ |
| 44 | + && v=`git describe --abbrev=4 --match="$match" HEAD 2>/dev/null \ |
| 45 | || git describe --abbrev=4 HEAD 2>/dev/null` \ |
| 46 | && v=`printf '%s\n' "$v" | sed "$tag_sed_script"` \ |
| 47 | && case $v in |