From a45897e303bf57a256467a713d21c937ee702341 Mon Sep 17 00:00:00 2001 From: DW Date: Fri, 12 Apr 2024 14:03:02 +0200 Subject: [PATCH] fix: version fetched from only digital git tags --- mrfCommon/src/genVersionHeader.pl | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/mrfCommon/src/genVersionHeader.pl b/mrfCommon/src/genVersionHeader.pl index 28ae666e..d87ad520 100644 --- a/mrfCommon/src/genVersionHeader.pl +++ b/mrfCommon/src/genVersionHeader.pl @@ -63,10 +63,19 @@ } if(!$foundvcs && -d "$opt_t/.git") { # same format as Mercurial - $result = `git --git-dir="$opt_t/.git" describe --tags --dirty`; - chomp($result); - if(!$? && length($result)>1) { - $opt_V = $result; + my @tags = `git --git-dir="$opt_t/.git" tag --sort=-creatordate`; + + my $valid_tag; + # find first tag which starts from number + foreach my $tag (@tags) { + chomp($tag); + if ($tag =~ /^\d/) { + $valid_tag = $tag; + last; + } + } + if (!$? && defined $valid_tag && length($valid_tag) > 1) { + $opt_V = $valid_tag; $foundvcs = 1; } }