aboutsummaryrefslogtreecommitdiffstats
path: root/midx-write.c
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2025-08-11 15:46:49 +0200
committerJunio C Hamano <gitster@pobox.com>2025-08-11 09:22:23 -0700
commit7744936f374308d6fa3c6e317fb8fe0b685d0ef2 (patch)
tree84e6c4d2ae9ddaba2aa5b2ef49bd1349b297f9bd /midx-write.c
parentmidx: write multi-pack indices via their source (diff)
downloadgit-7744936f374308d6fa3c6e317fb8fe0b685d0ef2.tar.gz
git-7744936f374308d6fa3c6e317fb8fe0b685d0ef2.zip
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>
Diffstat (limited to 'midx-write.c')
-rw-r--r--midx-write.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/midx-write.c b/midx-write.c
index bf7c01d4b1..84f76856d6 100644
--- a/midx-write.c
+++ b/midx-write.c
@@ -981,10 +981,11 @@ static int link_midx_to_chain(struct multi_pack_index *m)
for (i = 0; i < ARRAY_SIZE(midx_exts); i++) {
const unsigned char *hash = get_midx_checksum(m);
- get_midx_filename_ext(m->repo->hash_algo, &from, m->object_dir,
+ get_midx_filename_ext(m->source->odb->repo->hash_algo, &from,
+ m->source->path,
hash, midx_exts[i].non_split);
- get_split_midx_filename_ext(m->repo->hash_algo, &to,
- m->object_dir, hash,
+ get_split_midx_filename_ext(m->source->odb->repo->hash_algo, &to,
+ m->source->path, hash,
midx_exts[i].split);
if (link(from.buf, to.buf) < 0 && errno != ENOENT) {
@@ -1109,7 +1110,7 @@ static int write_midx_internal(struct odb_source *source,
if (flags & MIDX_WRITE_BITMAP && load_midx_revindex(m)) {
error(_("could not load reverse index for MIDX %s"),
hash_to_hex_algop(get_midx_checksum(m),
- m->repo->hash_algo));
+ m->source->odb->repo->hash_algo));
result = 1;
goto cleanup;
}