Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100755 43 lines (35 sloc) 0.738 kB
9b88fce Makefile: use git-describe to mark the git version.
Junio C Hamano authored
1 #!/bin/sh
2
3 GVF=GIT-VERSION-FILE
318721e @gitster Start 1.7.1 cycle
gitster authored
4 DEF_VER=v1.7.0.GIT
9b88fce Makefile: use git-describe to mark the git version.
Junio C Hamano authored
5
c96c290 GIT-VERSION-GEN: adjust for ancient git
Junio C Hamano authored
6 LF='
7 '
8
204d409 GIT-VERSION-FILE: check ./version first.
Junio C Hamano authored
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
0b8b051 GIT-VERSION-GEN: squelch unneeded error from "cat version"
Junio C Hamano authored
12 then
374dfaa Make GIT-VERSION-GEN tolerate missing git describe command again
Uwe Zeisberger authored
13 VN=$(cat version) || VN="$DEF_VER"
c48799e @hjemli Teach GIT-VERSION-GEN about the .git file
hjemli authored
14 elif test -d .git -o -f .git &&
204d409 GIT-VERSION-FILE: check ./version first.
Junio C Hamano authored
15 VN=$(git describe --abbrev=4 HEAD 2>/dev/null) &&
16 case "$VN" in
17 *$LF*) (exit 1) ;;
e5fc9a0 @gitster GIT 1.5.4.2
gitster authored
18 v[0-9]*)
b13d440 @gitster GIT-VERSION-GEN: mark the version 'dirty' only if there are modified …
gitster authored
19 git update-index -q --refresh
935e247 GIT-VERSION-GEN: do not fail if a 'HEAD' file exists in the working copy
Lea Wiemann authored
20 test -z "$(git diff-index --name-only HEAD --)" ||
31e0b2c @gitster GIT 1.5.4.3
gitster authored
21 VN="$VN-dirty" ;;
204d409 GIT-VERSION-FILE: check ./version first.
Junio C Hamano authored
22 esac
23 then
24 VN=$(echo "$VN" | sed -e 's/-/./g');
0b8b051 GIT-VERSION-GEN: squelch unneeded error from "cat version"
Junio C Hamano authored
25 else
26 VN="$DEF_VER"
374dfaa Make GIT-VERSION-GEN tolerate missing git describe command again
Uwe Zeisberger authored
27 fi
181129d For release tarballs, include the proper version
H. Peter Anvin authored
28
29 VN=$(expr "$VN" : v*'\(.*\)')
eb858c6 GIT-VERSION-GEN: detect dirty tree and mark the version accordingly.
Junio C Hamano authored
30
9b88fce Makefile: use git-describe to mark the git version.
Junio C Hamano authored
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
Something went wrong with that request. Please try again.