5 # #define BUILD_GIT_HEAD "<git-head-revision>"
6 # But do not touch $1 if the git-revision is already up-to-date.
9 if test "x$1" = "x" ; then
10 echo "usage: ./genversion <file>"
15 # Check whether this is a valid git repository.
16 # Set ISGIT to 1=true or 0=false.
20 REV=`git rev-parse --git-dir 2>/dev/null`
21 if test "x$?" = "x0" ; then
26 # Check the old revision from $1.
29 if test -f "$1" ; then
32 if test $ISGIT = 0 ; then
33 echo "WARNING: version file $1 is missing"
34 echo "#define BUILD_GIT_HEAD \"unknown-revision\""
42 # Check new revision from "git describe". However, if this is no valid
43 # git-repository, return success and do nothing.
46 if test $ISGIT = 0 ; then
51 NEWREV="#define BUILD_GIT_HEAD \"$NEWREV\""
54 # Exit if the file is already up to date.
55 # Otherwise, write the new revision into the file.
58 if test "x$OLDREV" = "x$NEWREV" ; then