| 471 | } |
| 472 | |
| 473 | off_t pack_pos_to_offset(struct packed_git *p, uint32_t pos) |
| 474 | { |
| 475 | if (!(p->revindex || p->revindex_data)) |
| 476 | BUG("pack_pos_to_index: reverse index not yet loaded"); |
| 477 | if (p->num_objects < pos) |
| 478 | BUG("pack_pos_to_offset: out-of-bounds object at %"PRIu32, pos); |
| 479 | |
| 480 | if (p->revindex) |
| 481 | return p->revindex[pos].offset; |
| 482 | else if (pos == p->num_objects) |
| 483 | return p->pack_size - p->repo->hash_algo->rawsz; |
| 484 | else |
| 485 | return nth_packed_object_offset(p, pack_pos_to_index(p, pos)); |
| 486 | } |
| 487 | |
| 488 | uint32_t pack_pos_to_midx(struct multi_pack_index *m, uint32_t pos) |
| 489 | { |
no test coverage detected