You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by bt...@apache.org on 2020/12/17 18:14:49 UTC

[incubator-nuttx] branch master updated: tools/version.sh: Fix the version retrieved from GIT.

This is an automated email from the ASF dual-hosted git repository.

btashton pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 076d899  tools/version.sh: Fix the version retrieved from GIT.
076d899 is described below

commit 076d89907f78995aeb68b4b3c5e702f76335aa04
Author: Abdelatif Guettouche <ab...@espressif.com>
AuthorDate: Thu Dec 17 09:57:35 2020 +0000

    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 <ab...@espressif.com>
---
 tools/version.sh | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/tools/version.sh b/tools/version.sh
index fd815da..813c97a 100755
--- a/tools/version.sh
+++ b/tools/version.sh
@@ -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