aboutsummaryrefslogtreecommitdiff
path: root/midx.c
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2026-03-05 15:19:42 +0100
committerJunio C Hamano <gitster@pobox.com>2026-03-05 11:45:14 -0800
commitcb506a8a69c953f7b87bb3ae099e0bed8218d3ab (patch)
tree2b469f6c020f5fc1889a01754ed99443085eeb61 /midx.c
parentba1c21d34346e5979f9308806274bfcda4949ad4 (diff)
downloadgit-cb506a8a69c953f7b87bb3ae099e0bed8218d3ab.tar.xz
odb: introduce "files" source
Introduce a new "files" object database source. This source encapsulates access to both loose object files and the packfile store, similar to how the "files" backend for refs encapsulates access to loose refs and the packed-refs file. Note that for now the "files" source is still a direct member of a `struct odb_source`. This architecture will be reversed in the next commit so that the files source contains a `struct odb_source`. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'midx.c')
-rw-r--r--midx.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/midx.c b/midx.c
index a75ea99a0d..698d10a1c6 100644
--- a/midx.c
+++ b/midx.c
@@ -95,8 +95,8 @@ static int midx_read_object_offsets(const unsigned char *chunk_start,
struct multi_pack_index *get_multi_pack_index(struct odb_source *source)
{
- packfile_store_prepare(source->packfiles);
- return source->packfiles->midx;
+ packfile_store_prepare(source->files->packed);
+ return source->files->packed->midx;
}
static struct multi_pack_index *load_multi_pack_index_one(struct odb_source *source,
@@ -459,7 +459,7 @@ int prepare_midx_pack(struct multi_pack_index *m,
strbuf_addf(&pack_name, "%s/pack/%s", m->source->path,
m->pack_names[pack_int_id]);
- p = packfile_store_load_pack(m->source->packfiles,
+ p = packfile_store_load_pack(m->source->files->packed,
pack_name.buf, m->source->local);
strbuf_release(&pack_name);
@@ -709,12 +709,12 @@ int prepare_multi_pack_index_one(struct odb_source *source)
if (!r->settings.core_multi_pack_index)
return 0;
- if (source->packfiles->midx)
+ if (source->files->packed->midx)
return 1;
- source->packfiles->midx = load_multi_pack_index(source);
+ source->files->packed->midx = load_multi_pack_index(source);
- return !!source->packfiles->midx;
+ return !!source->files->packed->midx;
}
int midx_checksum_valid(struct multi_pack_index *m)
@@ -803,9 +803,9 @@ void clear_midx_file(struct repository *r)
struct odb_source *source;
for (source = r->objects->sources; source; source = source->next) {
- if (source->packfiles->midx)
- close_midx(source->packfiles->midx);
- source->packfiles->midx = NULL;
+ if (source->files->packed->midx)
+ close_midx(source->files->packed->midx);
+ source->files->packed->midx = NULL;
}
}