tools/version.sh: Fix the version retrieved from GIT.

Use the branch's tag if one exist otherwise use the most recent one.

Signed-off-by: Abdelatif Guettouche <abdelatif.guettouche@espressif.com>
This commit is contained in:
Abdelatif Guettouche 2020-12-17 09:57:35 +00:00 committed by Brennan Ashton
parent 48ba0bb30a
commit 076d89907f

View file

@ -86,12 +86,10 @@ done
OUTFILE=$1
if [ -z ${VERSION} ] ; then
VERSION=`git -C ${WD} tag --sort=taggerdate | tail -1 | cut -d'-' -f2`
VERSION=`git -C ${WD} describe 2>/dev/null | tail -1 | cut -d'-' -f2`
# Earlier tags used the format "major.minor", append a "0" for a patch.
if [[ ${VERSION} =~ ^([0-9]+[\.][0-9]+)$ ]] ; then
VERSION=${VERSION}.0
if [[ ! ${VERSION} =~ ([0-9]+).([0-9]+).([0-9]+) ]] ; then
VERSION=`git -C ${WD} tag --sort=v:refname | tail -1 | cut -d'-' -f2`
fi
fi