Skip to content

Commit c39b02a

Browse files
derrickstoleegitster
authored andcommitted
midx: mark bad packed objects
When an object fails to decompress from a pack-file, we mark the object as 'bad' so we can retry with a different copy of the object (if such a copy exists). Before now, the multi-pack-index did not update the bad objects list for the pack-files it contains, and we did not check the bad objects list when reading an object. Now, do both. Signed-off-by: Derrick Stolee <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 2cf489a commit c39b02a

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

midx.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,16 @@ static int nth_midxed_pack_entry(struct multi_pack_index *m, struct pack_entry *
280280
if (!is_pack_valid(p))
281281
return 0;
282282

283+
if (p->num_bad_objects) {
284+
uint32_t i;
285+
struct object_id oid;
286+
nth_midxed_object_oid(&oid, m, pos);
287+
for (i = 0; i < p->num_bad_objects; i++)
288+
if (!hashcmp(oid.hash,
289+
p->bad_object_sha1 + the_hash_algo->rawsz * i))
290+
return 0;
291+
}
292+
283293
e->offset = nth_midxed_offset(m, pos);
284294
e->p = p;
285295

0 commit comments

Comments
 (0)