Skip to content

Commit

Permalink
Use full hash as version if no tags
Browse files Browse the repository at this point in the history
Signed-off-by: Adrien Gallouët <adrien@gallouet.fr>
  • Loading branch information
angt committed May 5, 2018
1 parent 841c2af commit ee9ed7e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
1 change: 0 additions & 1 deletion configure.ac
Expand Up @@ -4,7 +4,6 @@ AC_INIT([glorytun],
[https://github.com/angt/glorytun/issues],
[glorytun],
[https://github.com/angt/glorytun])
AC_DEFINE_UNQUOTED([VERSION_MAJOR], [m4_esyscmd([./version.sh major])])
AC_CONFIG_SRCDIR([src/common.h])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIR([m4])
Expand Down
13 changes: 6 additions & 7 deletions version.sh
@@ -1,13 +1,12 @@
#!/bin/sh

[ -z "${VERSION}" ] && VERSION=`git describe --tags --match='v[0-9].*' 2>/dev/null` \
&& VERSION=${VERSION#v}
[ -z "${VERSION}" ] && VERSION="$(git describe --tags --match='v[0-9].*' 2>/dev/null)" \
&& VERSION="${VERSION#v}"

[ -z "${VERSION}" ] && VERSION=`cat VERSION 2>/dev/null`
[ -z "${VERSION}" ] && VERSION="$(git rev-parse HEAD 2>/dev/null)"

[ -z "${VERSION}" ] && VERSION=0.0.0
[ -z "${VERSION}" ] && VERSION="$(cat VERSION 2>/dev/null)"

[ "$1" = "major" ] && printf ${VERSION%%.*} \
&& exit 0
[ -z "${VERSION}" ] && VERSION="0.0.0"

printf ${VERSION} | tee VERSION
printf "%s" "${VERSION}" | tee VERSION

0 comments on commit ee9ed7e

Please sign in to comment.