Skip to content

Commit 8c7abdc

Browse files
Haizzzttaylorr
authored andcommitted
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 <[email protected]> Signed-off-by: Taylor Blau <[email protected]>
1 parent 89aaab1 commit 8c7abdc

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

sparse-index.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -510,6 +510,8 @@ void clear_skip_worktree_from_present_files(struct index_state *istate)
510510
path_count[restarted]++;
511511
if (path_found(ce->name, &last_dirname, &dir_len, &dir_found)) {
512512
if (S_ISSPARSEDIR(ce->ce_mode)) {
513+
if (restarted)
514+
BUG("ensure-full-index did not fully flatten?");
513515
ensure_full_index(istate);
514516
restarted = 1;
515517
goto restart;

0 commit comments

Comments
 (0)