Skip to content

Commit d425f65

Browse files
derrickstoleegitster
authored andcommitted
dir: ensure full index
Before iterating over all cache entries, ensure that a sparse index is expanded to a full index to avoid unexpected behavior. Signed-off-by: Derrick Stolee <[email protected]> Reviewed-by: Elijah Newren <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 2508df0 commit d425f65

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

dir.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3533,6 +3533,8 @@ static void connect_wt_gitdir_in_nested(const char *sub_worktree,
35333533
if (repo_read_index(&subrepo) < 0)
35343534
die(_("index file corrupt in repo %s"), subrepo.gitdir);
35353535

3536+
/* TODO: audit for interaction with sparse-index. */
3537+
ensure_full_index(subrepo.index);
35363538
for (i = 0; i < subrepo.index->cache_nr; i++) {
35373539
const struct cache_entry *ce = subrepo.index->cache[i];
35383540

0 commit comments

Comments
 (0)