gitweb: Fix displaying unchopped argument in chop_and_escape_str
[git/spearce.git] / GIT-VERSION-GEN
blob1ad324e23696f66451a9ffc05d77f459bf106e83
1 #!/bin/sh
3 GVF=GIT-VERSION-FILE
4 DEF_VER=v1.5.4.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]*)
19 git diff-index --quiet HEAD || VN="$VN-dirty" ;;
20 esac
21 then
22 VN=$(echo "$VN" | sed -e 's/-/./g');
23 else
24 VN="$DEF_VER"
27 VN=$(expr "$VN" : v*'\(.*\)')
29 if test -r $GVF
30 then
31 VC=$(sed -e 's/^GIT_VERSION = //' <$GVF)
32 else
33 VC=unset
35 test "$VN" = "$VC" || {
36 echo >&2 "GIT_VERSION = $VN"
37 echo "GIT_VERSION = $VN" >$GVF