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