Skip to content

Commit b82a7b5

Browse files
pcloudsgitster
authored andcommitted
read-cache.c: use INDEX_FORMAT_{LB,UB} in verify_hdr()
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 300e39f commit b82a7b5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

read-cache.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1256,7 +1256,7 @@ static int verify_hdr(struct cache_header *hdr, unsigned long size)
12561256
if (hdr->hdr_signature != htonl(CACHE_SIGNATURE))
12571257
return error("bad signature");
12581258
hdr_version = ntohl(hdr->hdr_version);
1259-
if (hdr_version < 2 || 4 < hdr_version)
1259+
if (hdr_version < INDEX_FORMAT_LB || INDEX_FORMAT_UB < hdr_version)
12601260
return error("bad index version %d", hdr_version);
12611261
git_SHA1_Init(&c);
12621262
git_SHA1_Update(&c, hdr, size - 20);

0 commit comments

Comments
 (0)