midx: compute paths via their source

With the preceding commits we started to always have the object database
source available when we load, write or access multi-pack indices. With
this in place we can change how MIDX paths are computed so that we don't
have to pass in the combination of a hash algorithm and object directory
anymore, but only the object database source.

Refactor the code accordingly.

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:50 +02:00
committed by Junio C Hamano
parent 7744936f37
commit 13296ac909
5 changed files with 62 additions and 75 deletions

View File

@@ -389,12 +389,12 @@ int load_midx_revindex(struct multi_pack_index *m)
"source", "rev");
if (m->has_chain)
get_split_midx_filename_ext(m->source->odb->repo->hash_algo, &revindex_name,
m->source->path, get_midx_checksum(m),
get_split_midx_filename_ext(m->source, &revindex_name,
get_midx_checksum(m),
MIDX_EXT_REV);
else
get_midx_filename_ext(m->source->odb->repo->hash_algo, &revindex_name,
m->source->path, get_midx_checksum(m),
get_midx_filename_ext(m->source, &revindex_name,
get_midx_checksum(m),
MIDX_EXT_REV);
ret = load_revindex_from_disk(m->source->odb->repo->hash_algo,