GIT 1.1.6
[git/mingw/4msysgit/kblees.git] / GIT-VERSION-GEN
blob73aaff0a2979de8bcfd72f8a10793a07f17c18ad
1 #!/bin/sh
3 GVF=GIT-VERSION-FILE
4 DEF_VER=v1.1.GIT
6 # First try git-describe, then see if there is a version file
7 # (included in release tarballs), then default
8 VN=$(git-describe --abbrev=4 HEAD 2>/dev/null) ||
9 VN=$(cat version) ||
10 VN="$DEF_VER"
12 VN=$(expr "$VN" : v*'\(.*\)')
14 dirty=$(sh -c 'git-diff-index --name-only HEAD' 2>/dev/null) || dirty=
15 case "$dirty" in
16 '')
19 VN="$VN-dirty" ;;
20 esac
22 if test -r $GVF
23 then
24 VC=$(sed -e 's/^GIT_VERSION = //' <$GVF)
25 else
26 VC=unset
28 test "$VN" = "$VC" || {
29 echo >&2 "GIT_VERSION = $VN"
30 echo "GIT_VERSION = $VN" >$GVF