diff options
author | Taylor Blau <me@ttaylorr.com> | 2024-08-06 17:37:30 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2024-08-06 21:01:36 +0200 |
commit | 3f5f1cff92dfe64bbbfa9f2fb4ed810125810b1b (patch) | |
tree | 4bc0015be7250d54ab341a986dab37208e5cda25 /midx.h | |
parent | midx: teach `nth_bitmapped_pack()` about incremental MIDXs (diff) | |
download | git-3f5f1cff92dfe64bbbfa9f2fb4ed810125810b1b.tar.xz git-3f5f1cff92dfe64bbbfa9f2fb4ed810125810b1b.zip |
midx: introduce `bsearch_one_midx()`
The `bsearch_midx()` function will be extended in a following commit to
search for the location of a given object ID across all MIDXs in a chain
(or the single non-chain MIDX if no chain is available).
While most callers will naturally want to use the updated
`bsearch_midx()` function, there are a handful of special cases that
will want finer control and will only want to search through a single
MIDX.
For instance, the object abbreviation code, which cares about object IDs
near to where we'd expect to find a match in a MIDX. In that case, we
want to look at the nearby matches in each layer of the MIDX chain, not
just a single one).
Split the more fine-grained control out into a separate function called
`bsearch_one_midx()` which searches only a single MIDX.
At present both `bsearch_midx()` and `bsearch_one_midx()` have identical
behavior, but the following commit will rewrite the former to be aware
of incremental MIDXs for the remaining non-special case callers.
Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'midx.h')
-rw-r--r-- | midx.h | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -90,7 +90,10 @@ struct multi_pack_index *load_multi_pack_index(const char *object_dir, int local int prepare_midx_pack(struct repository *r, struct multi_pack_index *m, uint32_t pack_int_id); int nth_bitmapped_pack(struct repository *r, struct multi_pack_index *m, struct bitmapped_pack *bp, uint32_t pack_int_id); -int bsearch_midx(const struct object_id *oid, struct multi_pack_index *m, uint32_t *result); +int bsearch_one_midx(const struct object_id *oid, struct multi_pack_index *m, + uint32_t *result); +int bsearch_midx(const struct object_id *oid, struct multi_pack_index *m, + uint32_t *result); off_t nth_midxed_offset(struct multi_pack_index *m, uint32_t pos); uint32_t nth_midxed_pack_int_id(struct multi_pack_index *m, uint32_t pos); struct object_id *nth_midxed_object_oid(struct object_id *oid, |