git-config --get-color: get configured color
[git/jnareb-git/bp-gitweb.git] / GIT-VERSION-GEN
blob3c0032cec592a765692234f1cba47dfdcc3a9200
1 #!/bin/sh
3 GVF=GIT-VERSION-FILE
4 DEF_VER=v1.5.3.GIT
6 LF='
9 # First see if there is a version file (included in release tarballs),
10 # then try git-describe, then default.
11 if test -f version
12 then
13 VN=$(cat version) || VN="$DEF_VER"
14 elif test -d .git &&
15 VN=$(git describe --abbrev=4 HEAD 2>/dev/null) &&
16 case "$VN" in
17 *$LF*) (exit 1) ;;
18 v[0-9]*) : happy ;;
19 esac
20 then
21 VN=$(echo "$VN" | sed -e 's/-/./g');
22 else
23 VN="$DEF_VER"
26 VN=$(expr "$VN" : v*'\(.*\)')
28 dirty=$(sh -c 'git diff-index --name-only HEAD' 2>/dev/null) || dirty=
29 case "$dirty" in
30 '')
33 VN="$VN-dirty" ;;
34 esac
36 if test -r $GVF
37 then
38 VC=$(sed -e 's/^GIT_VERSION = //' <$GVF)
39 else
40 VC=unset
42 test "$VN" = "$VC" || {
43 echo >&2 "GIT_VERSION = $VN"
44 echo "GIT_VERSION = $VN" >$GVF