aboutsummaryrefslogtreecommitdiff
path: root/GIT-VERSION-GEN
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2006-01-09 18:07:01 -0800
committerJunio C Hamano <junkio@cox.net>2006-01-09 20:22:26 -0800
commit181129d24c83bfcbaa438579c5d3cd2531755232 (patch)
tree6be83afea866fe409bf56555fb346b3370807a5b /GIT-VERSION-GEN
parent5a2282de13c4da13f979185e652c8a08e2481fd1 (diff)
downloadgit-181129d24c83bfcbaa438579c5d3cd2531755232.tar.gz
git-181129d24c83bfcbaa438579c5d3cd2531755232.tar.xz
For release tarballs, include the proper version
When producing a release tarball, include a "version" file, which GIT-VERSION-GEN can then use to do the right thing when building from a tarball. Signed-off-by: H. Peter Anvin <hpa@zytor.com> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'GIT-VERSION-GEN')
-rwxr-xr-xGIT-VERSION-GEN10
1 files changed, 8 insertions, 2 deletions
diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN
index 845b9dce6..7763639a8 100755
--- a/GIT-VERSION-GEN
+++ b/GIT-VERSION-GEN
@@ -1,9 +1,15 @@
#!/bin/sh
GVF=GIT-VERSION-FILE
+DEF_VER=v1.1.GIT
-VN=$(git-describe --abbrev=4 HEAD 2>/dev/null) || VN=v1.0.GIT
-VN=$(expr "$VN" : v'\(.*\)')
+# First try git-describe, then see if there is a version file
+# (included in release tarballs), then default
+VN=$(git-describe --abbrev=4 HEAD 2>/dev/null) ||
+VN=$(cat version) ||
+VN="$DEF_VER"
+
+VN=$(expr "$VN" : v*'\(.*\)')
if test -r $GVF
then
VC=$(sed -e 's/^GIT_VERSION = //' <$GVF)