Thread (1 message) 1 message, 1 author, 2016-06-15

Re: new GIT-VERSION-GEN with old GIT

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:44:16
Subsystem: the rest · Maintainer: Linus Torvalds

Possibly related (same subject, not in this thread)

mkoegler@auto.tuwien.ac.at (Martin Koegler) writes:
On Debian, git 1.4.4 is still shipped in the stable distribution.

Since e5fc9a0aea2c3c49829b5cdf499339e5c759706b, simply running make in
a git checkout yields to an error message.

The error is in GIT-VERSION-GEN:
| + git diff-index --quiet HEAD
...
Sorry about that.  I already have forgotten that --quiet was a
relatively recent invention.

Before e5fc9a, we used --name-only, which was around forever.
The original diff-cache had it since mid July 2005, and the
command kept the option when it was renamed to diff-index in
early September 2005.  That is what we should use.


 GIT-VERSION-GEN |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN
index 03fb9d7..d4714ee 100755
--- a/GIT-VERSION-GEN
+++ b/GIT-VERSION-GEN
@@ -16,7 +16,8 @@ elif test -d .git &&
 	case "$VN" in
 	*$LF*) (exit 1) ;;
 	v[0-9]*)
-		git diff-index --quiet HEAD || VN="$VN-dirty" ;;
+		test -z "$(git diff-index --name-only HEAD)" ||
+		VN="$VN-dirty" ;;
 	esac
 then
 	VN=$(echo "$VN" | sed -e 's/-/./g');
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help