From 2cae30f776f00eb536aa633f7c3b7007002adf85 Mon Sep 17 00:00:00 2001 From: skarev Date: Tue, 12 Jan 2021 12:21:59 +0100 Subject: [PATCH 1/2] fix git tags sorting --- versiontag | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versiontag b/versiontag index bad456d..514667e 100755 --- a/versiontag +++ b/versiontag @@ -129,7 +129,7 @@ function showCurrentVersion() { # Get the last tag and breaks into parts function getLastTag() { - lasttag=`git tag | sort -r | grep "^v[0-9]*\.[0-9]*\.[0-9]" | head -1 2> /dev/null` || true + lasttag=`git tag -l --sort=-committerdate | grep "^v[0-9]*\.[0-9]*\.[0-9]" | head -1 2> /dev/null` || true if [[ -z "$lasttag" ]]; then lasttag='v0.0.0' From 0622e1eddac06fc60e364253a1fd0bcca3256998 Mon Sep 17 00:00:00 2001 From: skarev Date: Tue, 12 Jan 2021 14:17:07 +0100 Subject: [PATCH 2/2] remove redundant grep --- versiontag | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versiontag b/versiontag index 514667e..90082aa 100755 --- a/versiontag +++ b/versiontag @@ -129,7 +129,7 @@ function showCurrentVersion() { # Get the last tag and breaks into parts function getLastTag() { - lasttag=`git tag -l --sort=-committerdate | grep "^v[0-9]*\.[0-9]*\.[0-9]" | head -1 2> /dev/null` || true + lasttag=`git tag -l --sort=-committerdate | head -1 2> /dev/null` || true if [[ -z "$lasttag" ]]; then lasttag='v0.0.0'