Skip to content

Commit df7ede8

Browse files
ttaylorrgitster
authored andcommitted
midx: teach nth_midxed_offset() about incremental MIDXs
In a similar fashion as in previous commits, teach the function `nth_midxed_offset()` about incremental MIDXs. The given object `pos` is used to find the containing MIDX, and translated back into a MIDX-local position by assigning the return value of `midx_for_object()` to it. Signed-off-by: Taylor Blau <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 88f309e commit df7ede8

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

midx.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,8 @@ off_t nth_midxed_offset(struct multi_pack_index *m, uint32_t pos)
369369
const unsigned char *offset_data;
370370
uint32_t offset32;
371371

372+
pos = midx_for_object(&m, pos);
373+
372374
offset_data = m->chunk_object_offsets + (off_t)pos * MIDX_CHUNK_OFFSET_WIDTH;
373375
offset32 = get_be32(offset_data + sizeof(uint32_t));
374376

0 commit comments

Comments
 (0)