summaryrefslogtreecommitdiff
path: root/findversion.sh
diff options
context:
space:
mode:
Diffstat (limited to 'findversion.sh')
-rwxr-xr-xfindversion.sh15
1 files changed, 10 insertions, 5 deletions
diff --git a/findversion.sh b/findversion.sh
index ead908167..5d2322adb 100755
--- a/findversion.sh
+++ b/findversion.sh
@@ -67,20 +67,25 @@ if [ -d "$ROOT_DIR/.git" ]; then
MODIFIED="2"
fi
HASH=`LC_ALL=C git rev-parse --verify HEAD 2>/dev/null`
- SHORTHASH=`echo ${HASH} | cut -c1-8`
+ SHORTHASH=`echo ${HASH} | cut -c1-10`
ISODATE=`LC_ALL=C git show -s --pretty='format:%ci' HEAD | "$AWK" '{ gsub("-", "", $1); print $1 }'`
BRANCH="`git symbolic-ref -q HEAD 2>/dev/null | sed 's@.*/@@'`"
TAG="`git name-rev --name-only --tags --no-undefined HEAD 2>/dev/null | sed 's@\^0$@@'`"
+ if [ "$MODIFIED" -eq "0" ]; then
+ hashprefix="-g"
+ elif [ "$MODIFIED" -eq "2" ]; then
+ hashprefix="-m"
+ else
+ hashprefix="-u"
+ fi
+
if [ -n "$TAG" ]; then
VERSION="${TAG}"
else
- VERSION="${ISODATE}-${BRANCH}-g${SHORTHASH}"
+ VERSION="${ISODATE}-${BRANCH}${hashprefix}${SHORTHASH}"
fi
- if [ "$MODIFIED" -eq "2" ]; then
- VERSION="${VERSION}M"
- fi
elif [ -f "$ROOT_DIR/.ottdrev" ]; then
# We are an exported source bundle
cat $ROOT_DIR/.ottdrev