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:
committed by
Junio C Hamano
parent
c3f5d25146
commit
7744936f37
@@ -223,9 +223,10 @@ static void mark_packs_for_deletion(struct existing_packs *existing,
|
||||
static void remove_redundant_pack(const char *dir_name, const char *base_name)
|
||||
{
|
||||
struct strbuf buf = STRBUF_INIT;
|
||||
struct multi_pack_index *m = get_multi_pack_index(the_repository->objects->sources);
|
||||
struct odb_source *source = the_repository->objects->sources;
|
||||
struct multi_pack_index *m = get_multi_pack_index(source);
|
||||
strbuf_addf(&buf, "%s.pack", base_name);
|
||||
if (m && m->local && midx_contains_pack(m, buf.buf))
|
||||
if (m && source->local && midx_contains_pack(m, buf.buf))
|
||||
clear_midx_file(the_repository);
|
||||
strbuf_insertf(&buf, 0, "%s/", dir_name);
|
||||
unlink_pack_path(buf.buf, 1);
|
||||
|
||||
Reference in New Issue
Block a user