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');