midx: stop duplicating info redundant with its owning source

Multi-pack indices store some information that is redundant with their
owning source:

  - The locality bit that tracks whether the source is the primary
    object source or an alternate.

  - The object directory path the multi-pack index is located in.

  - The pointer to the owning parent directory.

All of this information is already contained in `struct odb_source`. So
now that we always have that struct available when loading a multi-pack
index we have it readily accessible.

Drop the redundant information and instead store a pointer to the object
source.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Patrick Steinhardt
2025-08-11 15:46:49 +02:00
committed by Junio C Hamano
parent c3f5d25146
commit 7744936f37
7 changed files with 36 additions and 35 deletions

View File

@@ -379,25 +379,25 @@ int load_midx_revindex(struct multi_pack_index *m)
* not want to accidentally call munmap() in the middle of the
* MIDX.
*/
trace2_data_string("load_midx_revindex", m->repo,
trace2_data_string("load_midx_revindex", m->source->odb->repo,
"source", "midx");
m->revindex_data = (const uint32_t *)m->chunk_revindex;
return 0;
}
trace2_data_string("load_midx_revindex", m->repo,
trace2_data_string("load_midx_revindex", m->source->odb->repo,
"source", "rev");
if (m->has_chain)
get_split_midx_filename_ext(m->repo->hash_algo, &revindex_name,
m->object_dir, get_midx_checksum(m),
get_split_midx_filename_ext(m->source->odb->repo->hash_algo, &revindex_name,
m->source->path, get_midx_checksum(m),
MIDX_EXT_REV);
else
get_midx_filename_ext(m->repo->hash_algo, &revindex_name,
m->object_dir, get_midx_checksum(m),
get_midx_filename_ext(m->source->odb->repo->hash_algo, &revindex_name,
m->source->path, get_midx_checksum(m),
MIDX_EXT_REV);
ret = load_revindex_from_disk(m->repo->hash_algo,
ret = load_revindex_from_disk(m->source->odb->repo->hash_algo,
revindex_name.buf,
m->num_objects,
&m->revindex_map,