[asterisk-commits] Remove GIT prefix, add hash only when dirty (repotools[master])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Aug 1 20:19:20 CDT 2016


George Joseph has submitted this change and it was merged.

Change subject: Remove GIT prefix, add hash only when dirty
......................................................................


Remove GIT prefix, add hash only when dirty

Change-Id: Ia744e4292ab00b5030b24a5ef0ed67d8624e3cd5
---
M build_tools/make_version
1 file changed, 11 insertions(+), 3 deletions(-)

Approvals:
  George Joseph: Looks good to me, approved; Verified



diff --git a/build_tools/make_version b/build_tools/make_version
index ab823e7..9b7a118 100755
--- a/build_tools/make_version
+++ b/build_tools/make_version
@@ -23,16 +23,24 @@
         exit 1
     fi
     MODIFIED=""
-    VERSION=`${GIT} describe --long --always --tags --dirty=M 2> /dev/null`
-    if [ $? -ne 0 ]; then
+    VERSION=`${GIT} describe --tags --dirty 2> /dev/null`
+    if [ $? -eq 0 ]; then
+        if [ "${VERSION:(-6)}" = "-dirty" ]; then
+            VERSION=`${GIT} describe --tags --long --dirty=M 2> /dev/null`
+            VERSION="GIT-${VERSION}"
+        elif [ -z "`${GIT} tag --contains HEAD`" ]; then
+            VERSION="GIT-${VERSION}"
+        fi
+    else
         if [ "`${GIT} ls-files -m | wc -l`" != "0" ]; then
             MODIFIED="M"
         fi
         # Some older versions of git do not support all the above
         # options.
         VERSION=`${GIT} rev-parse --short --verify HEAD`${MODIFIED}
+        VERSION="GIT-${VERSION}"
     fi
-    echo GIT-${VERSION}
+    echo ${VERSION}
 else
   echo "UNKNOWN_and_probably_unsupported"
 fi

-- 
To view, visit https://gerrit.asterisk.org/3388
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ia744e4292ab00b5030b24a5ef0ed67d8624e3cd5
Gerrit-PatchSet: 3
Gerrit-Project: repotools
Gerrit-Branch: master
Gerrit-Owner: Scott Griepentrog <sgriepentrog at digium.com>
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>



More information about the asterisk-commits mailing list