test: remove httpd tests that ask for user
[git] / GIT-VERSION-GEN
1 #!/bin/sh
2
3 GVF=GIT-VERSION-FILE
4 DEF_VER=v2.8.0+fc1
5
6 LF='
7 '
8
9 describe () {
10         VN=$(git describe --match "v[0-9]*" --abbrev=7 HEAD 2>/dev/null) || return 1
11         case "$VN" in
12         *$LF*)
13                 return 1
14                 ;;
15         v[0-9]*)
16                 git update-index -q --refresh
17                 test -z "$(git diff-index --name-only HEAD --)" ||
18                 VN="$VN-dirty"
19                 return 0
20                 ;;
21         esac
22 }
23
24 # First see if there is a version file (included in release tarballs),
25 # then try 'git describe', then default.
26 if test -f version
27 then
28         VN=$(cat version) || VN="$DEF_VER"
29 elif test -d ${GIT_DIR:-.git} -o -f .git && describe
30 then
31         VN=$(echo "$VN" | sed -e 's/-/~/g')
32 else
33         VN="$DEF_VER"
34 fi
35
36 VN=$(expr "$VN" : v*'\(.*\)')
37
38 if test -r $GVF
39 then
40         VC=$(sed -e 's/^GIT_VERSION = //' <$GVF)
41 else
42         VC=unset
43 fi
44 test "$VN" = "$VC" && exit
45 echo >&2 "GIT_VERSION = $VN"
46 echo "GIT_VERSION = $VN" >$GVF