Skip to content

Commit 15e42fb

Browse files
authored
Merge pull request libgit2#6585 from libgit2/cmn/midx-no-oid-verify
midx: do not try to look at every object in the index
2 parents 40ed228 + c1aa021 commit 15e42fb

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

src/libgit2/midx.c

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,6 @@ static int midx_parse_oid_lookup(
114114
const unsigned char *data,
115115
struct git_midx_chunk *chunk_oid_lookup)
116116
{
117-
uint32_t i;
118-
unsigned char *oid, *prev_oid, zero_oid[GIT_OID_MAX_SIZE] = {0};
119117
size_t oid_size = git_oid_size(idx->oid_type);
120118

121119
if (chunk_oid_lookup->offset == 0)
@@ -125,13 +123,7 @@ static int midx_parse_oid_lookup(
125123
if (chunk_oid_lookup->length != idx->num_objects * oid_size)
126124
return midx_error("OID Lookup chunk has wrong length");
127125

128-
idx->oid_lookup = oid = (unsigned char *)(data + chunk_oid_lookup->offset);
129-
prev_oid = zero_oid;
130-
for (i = 0; i < idx->num_objects; ++i, oid += oid_size) {
131-
if (git_oid_raw_cmp(prev_oid, oid, oid_size) >= 0)
132-
return midx_error("OID Lookup index is non-monotonic");
133-
prev_oid = oid;
134-
}
126+
idx->oid_lookup = (unsigned char *)(data + chunk_oid_lookup->offset);
135127

136128
return 0;
137129
}

0 commit comments

Comments
 (0)