cast sizeof() to unsigned to avoid warnings on 64-bit
[pcu.git] / GIT-VERSION-GEN
blob54c225b04ae3aa3cae5ea6f80097065fc76aa883
1 #!/bin/sh
3 GVF=GIT-VERSION-FILE
4 DEF_VER=v0.2.0
6 LF='
9 if test -d .git -o -f .git &&
10 VN=$(git describe --abbrev=4 HEAD 2>/dev/null) &&
11 case "$VN" in
12 *$LF*) (exit 1) ;;
13 v[0-9]*)
14 git update-index -q --refresh
15 test -z "$(git diff-index --name-only HEAD --)" ||
16 VN="$VN-dirty" ;;
17 esac
18 then
19 VN=$(echo "$VN" | sed -e 's/-/./g');
20 else
21 VN="$DEF_VER"
24 VN=$(expr "$VN" : v*'\(.*\)')
26 if test -r $GVF
27 then
28 VC=$(sed -e 's/^GIT_VERSION = //' <$GVF)
29 else
30 VC=unset
32 test "$VN" = "$VC" || {
33 echo >&2 "GIT_VERSION = $VN"
34 echo "GIT_VERSION = $VN" >$GVF