summaryrefslogtreecommitdiffstats
path: root/script
diff options
context:
space:
mode:
authorDave Davenport <qball@gmpclient.org>2016-04-10 13:22:49 +0200
committerDave Davenport <qball@gmpclient.org>2016-04-10 13:22:49 +0200
commit93362d63f2446fe9d1968eccf0f119516da3bf3a (patch)
tree26b949c5475c64944d671f0c07395ed18c24d7da /script
parenta69754abff2f86ca21f28bdafeaab9be9347b3d7 (diff)
Update git revision script.
Diffstat (limited to 'script')
-rwxr-xr-xscript/get_git_rev.sh7
1 files changed, 4 insertions, 3 deletions
diff --git a/script/get_git_rev.sh b/script/get_git_rev.sh
index 3cf335f1..ee718d5e 100755
--- a/script/get_git_rev.sh
+++ b/script/get_git_rev.sh
@@ -2,18 +2,19 @@
DIR=$1
FILE=$2
+GIT=$(which git)
-if [ -d "${DIR}/.git/" ]
+if [ -d "${DIR}/.git/" ] && [ -n "${GIT}" ]
then
echo -n "#define GIT_VERSION \"" > ${FILE}.tmp
- REV="$(git describe --tags --always --dirty) ($(git describe --tags --always --all | sed -e 's:heads/::'))"
+ REV="$(${GIT} describe --tags --always --dirty) ($(${GIT} describe --tags --always --all | sed -e 's:heads/::'))"
echo -n "${REV}" >> ${FILE}.tmp
echo "\"" >> ${FILE}.tmp
else
echo "#undef GIT_VERSION" > ${FILE}.tmp
fi
-if ! diff ${FILE}.tmp ${FILE} > /dev/null
+if [ ! -f ${FILE} ] || ! diff ${FILE}.tmp ${FILE} > /dev/null
then
mv ${FILE}.tmp ${FILE}
else