From: Junio C Hamano Date: Tue, 3 Apr 2012 22:53:12 +0000 (-0700) Subject: read-cache.c: report the header version we do not understand X-Git-Tag: v1.7.11-rc0~76^2~7 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=0136bac9b8a449cdf2179ad0242e079262b0aeea;p=git.git read-cache.c: report the header version we do not understand Instead of just saying "bad index version", report the value we read from the disk. Signed-off-by: Junio C Hamano --- diff --git a/read-cache.c b/read-cache.c index 58bfb2481..2d938263a 100644 --- a/read-cache.c +++ b/read-cache.c @@ -1247,11 +1247,13 @@ static int verify_hdr(struct cache_header *hdr, unsigned long size) { git_SHA_CTX c; unsigned char sha1[20]; + int hdr_version; if (hdr->hdr_signature != htonl(CACHE_SIGNATURE)) return error("bad signature"); - if (hdr->hdr_version != htonl(2) && hdr->hdr_version != htonl(3)) - return error("bad index version"); + hdr_version = ntohl(hdr->hdr_version); + if (hdr_version < 2 || 3 < hdr_version) + return error("bad index version %d", hdr_version); git_SHA1_Init(&c); git_SHA1_Update(&c, hdr, size - 20); git_SHA1_Final(sha1, &c);