Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
read-cache.c: report the header version we do not understand
author
Junio C Hamano
<gitster@pobox.com>
Tue, 3 Apr 2012 22:53:12 +0000
(15:53 -0700)
committer
Junio C Hamano
<gitster@pobox.com>
Tue, 3 Apr 2012 23:24:45 +0000
(16:24 -0700)
Instead of just saying "bad index version", report the value we read
from the disk.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
read-cache.c
patch
|
blob
|
history
raw
|
patch
| inline |
side by side
(parent:
936f53d
)
diff --git
a/read-cache.c
b/read-cache.c
index 58bfb2481dad720ac74af304bc72325102124450..2d938263adf886ff4b5bb5a0c039ed9552df6a27 100644
(file)
--- 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);