From: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
To: git@vger.kernel.org
Cc: "Junio C Hamano" <gitster@pobox.com>,
"Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
Subject: [PATCH 2/2] read-cache.c: use INDEX_FORMAT_{LB,UB} in verify_hdr()
Date: Fri, 22 Feb 2013 19:09:24 +0700 [thread overview]
Message-ID: <1361534964-4232-2-git-send-email-pclouds@gmail.com> (raw)
In-Reply-To: <1361534964-4232-1-git-send-email-pclouds@gmail.com>
9d22778 (read-cache.c: write prefix-compressed names in the index -
2012-04-04) defined these. Interestingly, they were not used by
read-cache.c, or anywhere in that patch. They were used in
builtin/update-index.c later for checking supported index
versions. Use them here too.
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
read-cache.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/read-cache.c b/read-cache.c
index 827ae55..298161f 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -1260,7 +1260,8 @@ static int verify_hdr(struct cache_header *hdr, unsigned long size)
if (hdr->hdr_signature != htonl(CACHE_SIGNATURE))
return error("bad signature");
hdr_version = ntohl(hdr->hdr_version);
- if (hdr_version < 2 || 4 < hdr_version)
+ if (hdr_version < INDEX_FORMAT_LB ||
+ hdr_version > INDEX_FORMAT_UB)
return error("bad index version %d", hdr_version);
git_SHA1_Init(&c);
git_SHA1_Update(&c, hdr, size - 20);
--
1.8.1.2.536.gf441e6d
next prev parent reply other threads:[~2013-02-22 12:09 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-22 12:09 [PATCH 1/2] index-format.txt: mention of v4 is missing in some places Nguyễn Thái Ngọc Duy
2013-02-22 12:09 ` Nguyễn Thái Ngọc Duy [this message]
2013-02-22 20:49 ` [PATCH 2/2] read-cache.c: use INDEX_FORMAT_{LB,UB} in verify_hdr() Junio C Hamano
2013-02-23 1:54 ` [PATCH 3/2] update-index: list supported idx versions and their features Nguyễn Thái Ngọc Duy
2013-02-23 20:53 ` Jonathan Nieder
2013-02-23 21:23 ` Junio C Hamano
2013-02-23 21:53 ` Jonathan Nieder
2013-02-23 2:29 ` [PATCH v2 " Nguyễn Thái Ngọc Duy
2013-02-23 20:55 ` Jonathan Nieder
2013-02-22 20:46 ` [PATCH 1/2] index-format.txt: mention of v4 is missing in some places Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1361534964-4232-2-git-send-email-pclouds@gmail.com \
--to=pclouds@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).