From 545c423b61e3852f23577ab2120a7312a7b088d5 Mon Sep 17 00:00:00 2001 From: Dave Davenport Date: Sat, 12 Mar 2016 14:00:19 +0100 Subject: Tried to fix strlen on NULL --- script/get_git_rev.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100755 script/get_git_rev.sh (limited to 'script') 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 -- cgit v1.2.3