For release tarballs, include the proper version
[thirdparty/git.git] / GIT-VERSION-GEN
CommitLineData
9b88fcef
JH
1#!/bin/sh
2
3GVF=GIT-VERSION-FILE
181129d2 4DEF_VER=v1.1.GIT
9b88fcef 5
181129d2
PA
6# First try git-describe, then see if there is a version file
7# (included in release tarballs), then default
8VN=$(git-describe --abbrev=4 HEAD 2>/dev/null) ||
9VN=$(cat version) ||
10VN="$DEF_VER"
11
12VN=$(expr "$VN" : v*'\(.*\)')
9b88fcef
JH
13if test -r $GVF
14then
15 VC=$(sed -e 's/^GIT_VERSION = //' <$GVF)
16else
17 VC=unset
18fi
19test "$VN" = "$VC" || {
20 echo >&2 "GIT_VERSION = $VN"
21 echo "GIT_VERSION = $VN" >$GVF
22}
23
24