diff --git a/scripts/current-version b/scripts/current-version index 734093f6d1..8f3ddb017f 100755 --- a/scripts/current-version +++ b/scripts/current-version @@ -11,13 +11,14 @@ strip_pkg() { sed -Ee 's/-(deb|rpm)[0-9]+//' <<< $1 } -latest_tag="git describe --abbrev=0 --match v[0-9]*" +SCRIPTS_DIR="$( cd "$( dirname ${BASH_SOURCE[0]} )" && pwd )" +REPO_DIR="$( cd "$SCRIPTS_DIR/.." && pwd )" -tag=$($latest_tag --exact-match 2>/dev/null) +tag="$( git -C "$REPO_DIR" describe --abbrev=0 --tags --exact-match --match 'v[0-9]*' 2>/dev/null || true )" if test -z $tag || [[ $tag =~ (deb|rpm) ]] then - tag=$($latest_tag)-post + tag="$( git ls-remote --refs --tags -q | tail -n 1 | awk -F/ '{ print $3 }' )-post" fi if test -z $tag