You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2020/12/16 06:58:01 UTC

[GitHub] [incubator-nuttx] anchao commented on issue #2529: version.sh does not use the "latest" tag just most recent

anchao commented on issue #2529:
URL: https://github.com/apache/incubator-nuttx/issues/2529#issuecomment-745808042


   > > Maybe a solution is to check with something like git describe first then go to the list of tags?
   > 
   > Tried the following, seems to work.
   > 
   > ```diff
   > diff --git a/tools/version.sh b/tools/version.sh
   > index fd815daa91..0a1afac697 100755
   > --- a/tools/version.sh
   > +++ b/tools/version.sh
   > @@ -86,7 +86,11 @@ done
   >  OUTFILE=$1
   > 
   >  if [ -z ${VERSION} ] ; then
   > -  VERSION=`git -C ${WD} tag --sort=taggerdate | tail -1 | cut -d'-' -f2`
   > +  VERSION=`git -C ${WD} describe --exact-match 2>/dev/null | tail -1 | cut -d'-' -f2`
   > +
   > +  if [ -z ${VERSION} ] ; then
   > +    VERSION=`git tag -l --sort=v:refname | tail -1 | cut -d'-' -f2`
   > +  fi
   > 
   >    # Earlier tags used the format "major.minor", append a "0" for a patch.
   > ```
   
   I recommend the approach of @Ouss4 , "v:refname" is a good choice. 


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org