diff options
-rwxr-xr-x | script/get_git_rev.sh | 7 |
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 |