]>
Commit | Line | Data |
---|---|---|
9b88fcef JH |
1 | #!/bin/sh |
2 | ||
3 | GVF=GIT-VERSION-FILE | |
5fd09df3 | 4 | DEF_VER=v1.8.5-rc3 |
9b88fcef | 5 | |
c96c2909 JH |
6 | LF=' |
7 | ' | |
8 | ||
204d4092 JH |
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 | |
0b8b051c | 12 | then |
374dfaa2 | 13 | VN=$(cat version) || VN="$DEF_VER" |
05a95063 | 14 | elif test -d ${GIT_DIR:-.git} -o -f .git && |
bf505158 | 15 | VN=$(git describe --match "v[0-9]*" --abbrev=7 HEAD 2>/dev/null) && |
204d4092 JH |
16 | case "$VN" in |
17 | *$LF*) (exit 1) ;; | |
e5fc9a0a | 18 | v[0-9]*) |
b13d4409 | 19 | git update-index -q --refresh |
935e247e | 20 | test -z "$(git diff-index --name-only HEAD --)" || |
31e0b2ca | 21 | VN="$VN-dirty" ;; |
204d4092 JH |
22 | esac |
23 | then | |
24 | VN=$(echo "$VN" | sed -e 's/-/./g'); | |
0b8b051c JH |
25 | else |
26 | VN="$DEF_VER" | |
374dfaa2 | 27 | fi |
181129d2 PA |
28 | |
29 | VN=$(expr "$VN" : v*'\(.*\)') | |
eb858c60 | 30 | |
9b88fcef JH |
31 | if test -r $GVF |
32 | then | |
33 | VC=$(sed -e 's/^GIT_VERSION = //' <$GVF) | |
34 | else | |
35 | VC=unset | |
36 | fi | |
37 | test "$VN" = "$VC" || { | |
38 | echo >&2 "GIT_VERSION = $VN" | |
39 | echo "GIT_VERSION = $VN" >$GVF | |
40 | } | |
41 | ||
42 |