From fb22a01a088558f5e914d580bb295795fdc32098 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kornel=20Lesin=CC=81ski?= Date: Sat, 12 Nov 2016 14:22:42 +0000 Subject: [PATCH] Don't append hash to versions of builds with a tag --- Configurations/set-git-version-info.sh | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/Configurations/set-git-version-info.sh b/Configurations/set-git-version-info.sh index 8a79052c..43a7e516 100755 --- a/Configurations/set-git-version-info.sh +++ b/Configurations/set-git-version-info.sh @@ -13,14 +13,20 @@ if [ -z "$SRCROOT" ] || \ exit 1 fi -# Get the current Git master hash -version=$(cd "$SRCROOT" ; git show-ref --abbrev heads/master | awk '{print $1}') -if [ -z "$version" ] ; then - echo "$0: Can't find a Git hash!" 1>&2 +version="$CURRENT_PROJECT_VERSION" + +# Get version in format 1.x.x-commits-hash +gitversion=$(cd "$SRCROOT" ; git describe --tags --match '1.*') +if [ -z "$gitversion" ] ; then + echo "$0: Can't find a Git hash!" 1>&2 exit 0 fi -version="$CURRENT_PROJECT_VERSION git-$version" +# remove everything before the first "-" to keep the hash part only +versionsuffix=${gitversion#*-}; +if [ "$versionsuffix" != "$gitversion" ]; then + version="$version $versionsuffix" +fi # and use it to set the CFBundleShortVersionString value export PATH="$PATH:/usr/libexec"