@matheusbsbs / matheus-bagliano / commits / c96c29093f
Fork 0

GIT-VERSION-GEN: adjust for ancient git

When an ancient "git" that does not understand "describe" command is on the $PATH, "git describe" emitted a Usage message without exiting non-zero status (which is a mistake we cannot fix retroactively). Catch this case to make sure we do not try using phoney multi-line string as a version number. Signed-off-by: Junio C Hamano <junkio@cox.net>

Junio C Hamano committed Aug 8, 2006 at 13:11 UTC c96c29093f70f04e01ff1d3a9c1d509ef6afdb00
1 file changed +9 -1
GIT-VERSION-GEN
+9 -1
@@ -3,9 +3,17 @@
3 GVF=GIT-VERSION-FILE
4 DEF_VER=v1.4.2.GIT
5
6 +LF='
7 +'
8 +
9 # First try git-describe, then see if there is a version file
10 # (included in release tarballs), then default
8 -if VN=$(git describe --abbrev=4 HEAD 2>/dev/null); then
11 +if VN=$(git describe --abbrev=4 HEAD 2>/dev/null) &&
12 + case "$VN" in
13 + *$LF*) (exit 1) ;;
14 + v[0-9]*) : happy ;;
15 + esac
16 +then
17 VN=$(echo "$VN" | sed -e 's/-/./g');
18 elif test -f version
19 then