git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: new GIT-VERSION-GEN with old GIT

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 23, 2008, 18:46 UTC
Message-ID
<7vtzjz33zs.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<20080223173401.GA7808@auto.tuwien.ac.at>
mkoegler@auto.tuwien.ac.at (Martin Koegler) writes:
Show 8 quoted lines
> 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');
Previous: Martin Koegler
Message 2 of 2 in “new GIT-VERSION-GEN with old GIT”
  1. Martin KoeglerFeb 23, 2008
  2. Junio C HamanoFeb 23, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.