aboutsummaryrefslogtreecommitdiffstats
path: root/midx-write.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2025-07-28 14:26:31 -0700
committerJunio C Hamano <gitster@pobox.com>2025-07-28 14:26:32 -0700
commita6727995acaa7ed012de255cb79d84b51ee0eb0a (patch)
tree2e48ed51ced769f3f15ae601b74083cb6fcc1843 /midx-write.c
parentMerge branch 'kn/for-each-ref-skip' into next (diff)
parentmidx: remove now-unused linked list of multi-pack indices (diff)
downloadgit-a6727995acaa7ed012de255cb79d84b51ee0eb0a.tar.gz
git-a6727995acaa7ed012de255cb79d84b51ee0eb0a.zip
Merge branch 'ps/object-store-midx' into next
Redefine where the multi-pack-index sits in the object subsystem, which recently was restructured to allow multiple backends that support a single object source that belongs to one repository. A midx does span mulitple "object sources". * ps/object-store-midx: midx: remove now-unused linked list of multi-pack indices packfile: stop using linked MIDX list in `get_all_packs()` packfile: stop using linked MIDX list in `find_pack_entry()` packfile: refactor `get_multi_pack_index()` to work on sources midx: stop using linked list when closing MIDX packfile: refactor `prepare_packed_git_one()` to work on sources midx: start tracking per object database source
Diffstat (limited to 'midx-write.c')
-rw-r--r--midx-write.c22
1 files changed, 2 insertions, 20 deletions
diff --git a/midx-write.c b/midx-write.c
index f2cfb85476..c1ae62d354 100644
--- a/midx-write.c
+++ b/midx-write.c
@@ -916,26 +916,8 @@ cleanup:
static struct multi_pack_index *lookup_multi_pack_index(struct repository *r,
const char *object_dir)
{
- struct multi_pack_index *result = NULL;
- struct multi_pack_index *cur;
- char *obj_dir_real = real_pathdup(object_dir, 1);
- struct strbuf cur_path_real = STRBUF_INIT;
-
- /* Ensure the given object_dir is local, or a known alternate. */
- odb_find_source(r->objects, obj_dir_real);
-
- for (cur = get_multi_pack_index(r); cur; cur = cur->next) {
- strbuf_realpath(&cur_path_real, cur->object_dir, 1);
- if (!strcmp(obj_dir_real, cur_path_real.buf)) {
- result = cur;
- goto cleanup;
- }
- }
-
-cleanup:
- free(obj_dir_real);
- strbuf_release(&cur_path_real);
- return result;
+ struct odb_source *source = odb_find_source(r->objects, object_dir);
+ return get_multi_pack_index(source);
}
static int fill_packs_from_midx(struct write_midx_context *ctx,