Repository navigation
pr-2337/blanet/xx/split-index-skip-hash-v1
tagged this
26 Nov 13:57
From: Xing Xin <xingxin.xx@bytedance.com> The shared index of a split index is named after its trailing hash, which the split index records in its "link" extension to find it. Since ee1f0c242e (read-cache: add index.skipHash config option, 2023-01-06), do_write_index() skips that hash for the shared index too, so with index.skipHash and core.splitIndex both set, the shared index is written as "sharedindex.<null OID>" and the split index records a null OID as its base. Reading the index back, a null base means there is no shared index: the entries that were moved there are lost, "git ls-files" no longer shows them and "git status" reports them as deleted and untracked. With fsmonitor, it hits a BUG() in fsmonitor.c instead, as the fsmonitor bitmap refers to more entries than the index has. Scalar sets index.skipHash since 05f28e4b3c (scalar: use index.skipHash=true for performance, 2025-12-12), and feature.manyFiles implies it. The tests that ran into this under GIT_TEST_SPLIT_INDEX unset that variable instead, in 05f28e4b3c, in 7cce609e08 (t9210, t9211: disable GIT_TEST_SPLIT_INDEX for scalar clone tests, 2026-04-15) and in a644ad5f34 (status: lock the index only to write it, 2026-10-22). Let the callers of do_write_index() decide whether to skip the hash, and always compute it for the shared index. This keeps most of the benefit: the shared index is rewritten only now and then (see splitIndex.maxPercentChange), while the split index, written on every index update, still skips it. Add a test, and drop the workarounds, as those tests now pass with GIT_TEST_SPLIT_INDEX. Signed-off-by: Xing Xin <xingxin.xx@bytedance.com> Submitted-As: https://lore.kernel.org/git/pull.2337.git.1795701443098.gitgitgadget@gmail.com