Include commit hash if possible in versioning script, if a non-stable tree is compiled
This commit is contained in:
parent
c3ed2dadf3
commit
7e383c395e
1 changed files with 11 additions and 2 deletions
|
@ -1,8 +1,9 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
|
SCRIPT_DIR=$(dirname "$0")
|
||||||
DIRTY=""
|
DIRTY=""
|
||||||
|
|
||||||
if git status 1>/dev/null 2>/dev/null
|
if [ -d ${SCRIPT_DIR}/.git ] && git status 1>/dev/null 2>/dev/null
|
||||||
then
|
then
|
||||||
git update-index -q --ignore-submodules --refresh
|
git update-index -q --ignore-submodules --refresh
|
||||||
# Disallow unstaged changes in the working tree
|
# Disallow unstaged changes in the working tree
|
||||||
|
@ -31,8 +32,16 @@ then
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
VERSION=$(git describe 2>/dev/null)$DIRTY
|
VERSION=$(git describe 2>/dev/null)$DIRTY
|
||||||
|
elif [ -d ${SCRIPT_DIR}/.git ] && git log -n 1 1>/dev/null 2>/dev/null
|
||||||
|
then
|
||||||
|
VERSION=$(head -n 1 "${SCRIPT_DIR}/ChangeLog" | cut -d ' ' -f 2)
|
||||||
|
if [ "$VERSION" = "master" ]
|
||||||
|
then
|
||||||
|
PREVIOUS=$(grep '^2' "${SCRIPT_DIR}/ChangeLog" | head -n 2 | tail -n 1 | cut -d ' ' -f 2)
|
||||||
|
HASH=$(git log -n 1 --pretty=format:"%h" 2>/dev/null)
|
||||||
|
VERSION=$PREVIOUS-$HASH
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
SCRIPT_DIR=$(dirname "$0")
|
|
||||||
VERSION=$(head -n 1 "${SCRIPT_DIR}/ChangeLog" | cut -d ' ' -f 2)
|
VERSION=$(head -n 1 "${SCRIPT_DIR}/ChangeLog" | cut -d ' ' -f 2)
|
||||||
if [ "$VERSION" = "master" ]
|
if [ "$VERSION" = "master" ]
|
||||||
then
|
then
|
||||||
|
|
Loading…
Reference in a new issue