Re: [PATCH v2 08/24] midx: respect 'core.multiPackIndex' when writing
From: Jeff King <hidden>
Date: 2021-07-21 11:27:30
On Mon, Jun 21, 2021 at 06:25:18PM -0400, Taylor Blau wrote:
When writing a new multi-pack index, write_midx_internal() attempts to load any existing one to fill in some pieces of information. But it uses load_multi_pack_index(), which ignores the configuration "core.multiPackIndex", which indicates whether or not Git is allowed to read an existing multi-pack-index. Replace this with a routine that does respect that setting, to avoid reading multi-pack-index files when told not to. This avoids a problem that would arise in subsequent patches due to the combination of 'git repack' reopening the object store in-process and the multi-pack index code not checking whether a pack already exists in the object store when calling add_pack_to_midx(). This would ultimately lead to a cycle being created along the 'packed_git' struct's '->next' pointer. That is obviously bad, but it has hard-to-debug downstream effects like saying a bitmap can't be loaded for a pack because one already exists (for the same pack).
I'm not sure I completely understand the bug that this causes. But another question: does this impact how git -c core.multipackindex=false multi-pack-index write behaves? I.e., do we still write, but just avoid reading the existing midx? That itself seems like a more sensible behavior (e.g., trying to recover from a broken midx state). -Peff