open( $gitver, "git show-ref --tags -d | grep ^" . $_ . " | sed -e 's,.* refs/tags/,,' | grep " .$releaseid ." |sed -e 's/\\^{}//' 2> /dev/null |" );
my $gitbranch=`git rev-parse --abbrev-ref HEAD`;
if ($gitbranch eq "master" || $gitbranch =~ "release/"){
$last_release_tag=get_last_release_tag ($gitbranch);
$last_branch_tag=$last_release_tag;
$last_release_tag=get_last_release_tag ($gitbranch);
$last_branch_tag=get_last_branch_tag ($gitbranch);
print ("$last_branch_tag $last_release_tag");
my $headcommit=`git rev-parse HEAD`;
if ($last_branch_tag eq "") {
my $tagcommit=`git rev-list -n 1 $last_branch_tag`;
if ($headcommit ne $tagcommit) {
sub get_last_branch_tag () {
my $branchpattern = qr/^$gitbranch-\d+/;
return get_last_tag($gitbranch,$branchpattern,$delim)
sub get_last_release_tag () {
my $branchpattern = qr/^\d+\.\d+\.\d+\.\d+$/;
return get_last_tag($gitbranch,$branchpattern,$delim)
my $branchpattern = shift;
open( $githashes, "git log --since 2019-10-01 --simplify-by-decoration --pretty='%H' ".$gitbranch." |" );
chomp( @hashes = <$githashes> );