]> git.ipfire.org Git - thirdparty/git.git/blame - GIT-VERSION-GEN
Merge branch 'maint' of git://repo.or.cz/git-gui into maint
[thirdparty/git.git] / GIT-VERSION-GEN
CommitLineData
9b88fcef
JH
1#!/bin/sh
2
3GVF=GIT-VERSION-FILE
e5fc9a0a 4DEF_VER=v1.5.4.2.GIT
9b88fcef 5
c96c2909
JH
6LF='
7'
8
204d4092
JH
9# First see if there is a version file (included in release tarballs),
10# then try git-describe, then default.
11if test -f version
0b8b051c 12then
374dfaa2 13 VN=$(cat version) || VN="$DEF_VER"
204d4092
JH
14elif test -d .git &&
15 VN=$(git describe --abbrev=4 HEAD 2>/dev/null) &&
16 case "$VN" in
17 *$LF*) (exit 1) ;;
e5fc9a0a
JH
18 v[0-9]*)
19 git diff-index --quiet HEAD || VN="$VN-dirty" ;;
204d4092
JH
20 esac
21then
22 VN=$(echo "$VN" | sed -e 's/-/./g');
0b8b051c
JH
23else
24 VN="$DEF_VER"
374dfaa2 25fi
181129d2
PA
26
27VN=$(expr "$VN" : v*'\(.*\)')
eb858c60 28
9b88fcef
JH
29if test -r $GVF
30then
31 VC=$(sed -e 's/^GIT_VERSION = //' <$GVF)
32else
33 VC=unset
34fi
35test "$VN" = "$VC" || {
36 echo >&2 "GIT_VERSION = $VN"
37 echo "GIT_VERSION = $VN" >$GVF
38}
39
40