]> git.ipfire.org Git - thirdparty/git.git/blob - GIT-VERSION-GEN
For release tarballs, include the proper version
[thirdparty/git.git] / GIT-VERSION-GEN
1 #!/bin/sh
2
3 GVF=GIT-VERSION-FILE
4 DEF_VER=v1.1.GIT
5
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"
11
12 VN=$(expr "$VN" : v*'\(.*\)')
13 if test -r $GVF
14 then
15 VC=$(sed -e 's/^GIT_VERSION = //' <$GVF)
16 else
17 VC=unset
18 fi
19 test "$VN" = "$VC" || {
20 echo >&2 "GIT_VERSION = $VN"
21 echo "GIT_VERSION = $VN" >$GVF
22 }
23
24