GIT-VERSION-GEN: squelch unneeded error from "cat version"
Now this is really a corner case, but if you have the git source tree from somewhere other than the official tarball, you do not have version file. And if git-describe does not work for you (maybe you do not have git yet), we spilled an error message from "cat version". Signed-off-by: Junio C Hamano <junkio@cox.net>
Junio C Hamano committed
Mar 2, 2006 at 14:38 UTC
0b8b051cd50cb423476ab7a8aa5853dc601b721d
1 file changed
+4
-1
GIT-VERSION-GEN
+4
-1
@@ -7,8 +7,11 @@ DEF_VER=v1.2.GIT
7
# (included in release tarballs), then default
8
if VN=$(git-describe --abbrev=4 HEAD 2>/dev/null); then
9
VN=$(echo "$VN" | sed -e 's/-/./g');
10
-else
10
+elif test -f version
11
+then
12
VN=$(cat version) || VN="$DEF_VER"
13
+else
14
+ VN="$DEF_VER"
15
fi
16
17
VN=$(expr "$VN" : v*'\(.*\)')