From 4382f8c9bee8c89ae1d14b558b10e8695428ea85 Mon Sep 17 00:00:00 2001 From: Philippe Teuwen Date: Thu, 21 May 2020 11:50:03 +0200 Subject: [PATCH] mkversion: add --undecided --- tools/mkversion.pl | 7 ++++--- tools/mkversion.sh | 10 ++++++---- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/tools/mkversion.pl b/tools/mkversion.pl index 0d8b9de29..ea3b9940a 100644 --- a/tools/mkversion.pl +++ b/tools/mkversion.pl @@ -18,7 +18,7 @@ my $fullgitinfo = 'RRG/Iceman'; my $ctime; # GIT status 0 = dirty, 1 = clean , 2 = undecided my $clean = 2; - +my $undecided = (defined $ARGV[0]) && ($ARGV[0] =~ '--undecided'); # Do we have acces to git command? ####### # solves some bug on macos i.e: @@ -37,8 +37,9 @@ if ( defined($commandGIT) ) { # now avoiding the "fatal: No names found, cannot describe anything." error by fallbacking to abbrev hash in such case my $gitversion = `git describe --dirty --always`; my $gitbranch = `git rev-parse --abbrev-ref HEAD`; - $clean = $gitversion =~ '-dirty' ? 0 : 1; - + if (not $undecided) { + $clean = $gitversion =~ '-dirty' ? 0 : 1; + } if ( defined($gitbranch) and defined($gitversion) ) { $fullgitinfo = $fullgitinfo.'/'. $gitbranch . '/' . $gitversion; diff --git a/tools/mkversion.sh b/tools/mkversion.sh index cc713d635..850ef2101 100755 --- a/tools/mkversion.sh +++ b/tools/mkversion.sh @@ -21,10 +21,12 @@ if [ "$commandGIT" != "" ]; then # now avoiding the "fatal: No names found, cannot describe anything." error by fallbacking to abbrev hash in such case gitversion=$(git describe --dirty --always) gitbranch=$(git rev-parse --abbrev-ref HEAD) - if [ "$gitversion" != "${gitversion%-dirty}" ]; then - clean=0 - else - clean=1 + if [ "$1" != "--undecided" ]; then + if [ "$gitversion" != "${gitversion%-dirty}" ]; then + clean=0 + else + clean=1 + fi fi if [ "$gitbranch" != "" ] && [ "$gitversion" != "" ]; then fullgitinfo="${fullgitinfo}/${gitbranch}/${gitversion}"