aboutsummaryrefslogtreecommitdiffstats
path: root/midx.c
diff options
context:
space:
mode:
authorTaylor Blau <me@ttaylorr.com>2024-08-06 11:37:36 -0400
committerJunio C Hamano <gitster@pobox.com>2024-08-06 12:01:37 -0700
commitdf7ede83be829f983cd54539eb6fe0e6bddc8c9e (patch)
tree31ff414a82d64112fb75b7bdd51c341519d2c30c /midx.c
parent88f309e095d084d730f908fe1ec01a92c63612c2 (diff)
downloadgit-df7ede83be829f983cd54539eb6fe0e6bddc8c9e.tar.gz
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 <me@ttaylorr.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'midx.c')
-rw-r--r--midx.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/midx.c b/midx.c
index 83857cbd1e..346e58dec7 100644
--- a/midx.c
+++ b/midx.c
@@ -369,6 +369,8 @@ off_t nth_midxed_offset(struct multi_pack_index *m, uint32_t pos)
const unsigned char *offset_data;
uint32_t offset32;
+ pos = midx_for_object(&m, pos);
+
offset_data = m->chunk_object_offsets + (off_t)pos * MIDX_CHUNK_OFFSET_WIDTH;
offset32 = get_be32(offset_data + sizeof(uint32_t));