blob: bc6bc2d35256ad771389e71cb372338183a8eab2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
#!/bin/sh
cd $(dirname $0)
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
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
|