git-version-gen.diff 1.4 KB

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