| 590 | } |
| 591 | |
| 592 | int fill_midx_entry(struct multi_pack_index *m, |
| 593 | const struct object_id *oid, |
| 594 | struct pack_entry *e) |
| 595 | { |
| 596 | uint32_t pos; |
| 597 | uint32_t pack_int_id; |
| 598 | struct packed_git *p; |
| 599 | |
| 600 | if (!bsearch_midx(oid, m, &pos)) |
| 601 | return 0; |
| 602 | |
| 603 | midx_for_object(&m, pos); |
| 604 | pack_int_id = nth_midxed_pack_int_id(m, pos); |
| 605 | |
| 606 | if (prepare_midx_pack(m, pack_int_id)) |
| 607 | return 0; |
| 608 | p = m->packs[pack_int_id - m->num_packs_in_base]; |
| 609 | |
| 610 | /* |
| 611 | * We are about to tell the caller where they can locate the |
| 612 | * requested object. We better make sure the packfile is |
| 613 | * still here and can be accessed before supplying that |
| 614 | * answer, as it may have been deleted since the MIDX was |
| 615 | * loaded! |
| 616 | */ |
| 617 | if (!is_pack_valid(p)) |
| 618 | return 0; |
| 619 | |
| 620 | if (oidset_size(&p->bad_objects) && |
| 621 | oidset_contains(&p->bad_objects, oid)) |
| 622 | return 0; |
| 623 | |
| 624 | e->offset = nth_midxed_offset(m, pos); |
| 625 | e->p = p; |
| 626 | |
| 627 | return 1; |
| 628 | } |
| 629 | |
| 630 | /* Match "foo.idx" against either "foo.pack" _or_ "foo.idx". */ |
| 631 | int cmp_idx_or_pack_name(const char *idx_or_pack_name, |