2018-12-31 20:04:05 +01:00
|
|
|
#!/bin/sh
|
2021-12-08 17:43:21 +01:00
|
|
|
cd $(dirname $0)
|
2022-07-07 19:38:44 +02:00
|
|
|
commit="$(git rev-parse HEAD 2> /dev/null)"
|
|
|
|
commit="${commit:-unknown}"
|
|
|
|
git diff-index --quiet HEAD 2> /dev/null
|
|
|
|
if [ $? -ne 0 ]
|
|
|
|
then
|
|
|
|
dirty="true"
|
|
|
|
else
|
|
|
|
dirty="false"
|
|
|
|
fi
|
2018-12-31 20:04:05 +01:00
|
|
|
printf "#pragma once\n#define GIT_COMMIT \"$commit\"\n#define GIT_DIRTY $dirty\n" > auto/git_info.h.new
|
|
|
|
if cmp -s auto/git_info.h.new auto/git_info.h 2>&1 > /dev/null
|
|
|
|
then
|
|
|
|
rm -f auto/git_info.h.new
|
|
|
|
else
|
|
|
|
mv -f auto/git_info.h.new auto/git_info.h
|
|
|
|
fi
|