summaryrefslogtreecommitdiffstats
path: root/midx.c
diff options
context:
space:
mode:
authorDerrick Stolee <stolee@gmail.com>2018-07-12 21:39:35 +0200
committerJunio C Hamano <gitster@pobox.com>2018-07-20 20:27:28 +0200
commit8aac67a174061a0744557a3984a433f926bf5cb3 (patch)
tree047f3edd9e4c8980408627d983a0bcad94a5996c /midx.c
parentmidx: read objects from multi-pack-index (diff)
downloadgit-8aac67a174061a0744557a3984a433f926bf5cb3.tar.xz
git-8aac67a174061a0744557a3984a433f926bf5cb3.zip
midx: use midx in abbreviation calculations
Signed-off-by: Derrick Stolee <dstolee@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'midx.c')
-rw-r--r--midx.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/midx.c b/midx.c
index 182535933c..4e014ff6e3 100644
--- a/midx.c
+++ b/midx.c
@@ -203,6 +203,17 @@ int bsearch_midx(const struct object_id *oid, struct multi_pack_index *m, uint32
MIDX_HASH_LEN, result);
}
+struct object_id *nth_midxed_object_oid(struct object_id *oid,
+ struct multi_pack_index *m,
+ uint32_t n)
+{
+ if (n >= m->num_objects)
+ return NULL;
+
+ hashcpy(oid->hash, m->chunk_oid_lookup + m->hash_len * n);
+ return oid;
+}
+
static off_t nth_midxed_offset(struct multi_pack_index *m, uint32_t pos)
{
const unsigned char *offset_data;