diff options
author | Dave Davenport <qball@gmpclient.org> | 2016-03-12 14:00:19 +0100 |
---|---|---|
committer | Dave Davenport <qball@gmpclient.org> | 2016-03-12 14:00:19 +0100 |
commit | 545c423b61e3852f23577ab2120a7312a7b088d5 (patch) | |
tree | 4a99c9614a469f2f72cb96bdc60dbbae7c1f65b1 /script | |
parent | abe44475fc0d119d392d2fee7d407ef6e62bbf81 (diff) |
Tried to fix strlen on NULL
Diffstat (limited to 'script')
-rwxr-xr-x | script/get_git_rev.sh | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/script/get_git_rev.sh b/script/get_git_rev.sh new file mode 100755 index 00000000..c5ef9457 --- /dev/null +++ b/script/get_git_rev.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash + +DIR=$1 +FILE=$2 + +if [ -d "${DIR}/.git/" ] +then + echo -n "#define GIT_VERSION \"" > ${FILE}.tmp + REV=$(git log -1 --pretty=tformat:%h) + echo -n "${REV}" >> ${FILE}.tmp + echo "\"" >> ${FILE}.tmp +else + echo "#undef GIT_VERSION" > ${FILE}.tmp +fi + +if ! diff ${FILE}.tmp ${FILE} > /dev/null +then + mv ${FILE}.tmp ${FILE} +else + rm ${FILE}.tmp +fi |