git-version-gen.diff 1.6 KB

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