1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-21 10:26:08 +02:00

index: raise a bug if the index is materialised more than once

If clear_skip_worktree_from_present_files() encounter a sparse directory,
it fully materialise the index which should expand any sparse directories
and start going through each entries again. If this happens more than once,
raise it with a BUG.

Signed-off-by: Anh Le <anh@canva.com>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
This commit is contained in:
Anh Le 2022-11-03 23:05:01 +00:00 committed by Taylor Blau
parent 89aaab11a3
commit 8c7abdc596

View File

@ -510,6 +510,8 @@ void clear_skip_worktree_from_present_files(struct index_state *istate)
path_count[restarted]++;
if (path_found(ce->name, &last_dirname, &dir_len, &dir_found)) {
if (S_ISSPARSEDIR(ce->ce_mode)) {
if (restarted)
BUG("ensure-full-index did not fully flatten?");
ensure_full_index(istate);
restarted = 1;
goto restart;