| 454 | } |
| 455 | |
| 456 | int prepare_midx_pack(struct multi_pack_index *m, |
| 457 | uint32_t pack_int_id) |
| 458 | { |
| 459 | struct odb_source_files *files = odb_source_files_downcast(m->source); |
| 460 | struct strbuf pack_name = STRBUF_INIT; |
| 461 | struct packed_git *p; |
| 462 | |
| 463 | pack_int_id = midx_for_pack(&m, pack_int_id); |
| 464 | |
| 465 | if (m->packs[pack_int_id] == MIDX_PACK_ERROR) |
| 466 | return 1; |
| 467 | if (m->packs[pack_int_id]) |
| 468 | return 0; |
| 469 | |
| 470 | strbuf_addf(&pack_name, "%s/pack/%s", files->base.path, |
| 471 | m->pack_names[pack_int_id]); |
| 472 | p = packfile_store_load_pack(files->packed, |
| 473 | pack_name.buf, files->base.local); |
| 474 | strbuf_release(&pack_name); |
| 475 | |
| 476 | if (!p) { |
| 477 | m->packs[pack_int_id] = MIDX_PACK_ERROR; |
| 478 | return 1; |
| 479 | } |
| 480 | |
| 481 | p->multi_pack_index = 1; |
| 482 | m->packs[pack_int_id] = p; |
| 483 | |
| 484 | return 0; |
| 485 | } |
| 486 | |
| 487 | struct packed_git *nth_midxed_pack(struct multi_pack_index *m, |
| 488 | uint32_t pack_int_id) |
no test coverage detected