[PATCH 18/27] dir: ensure full index

From
Derrick Stolee via GitGitGadget <hidden>
Date
2021-03-16 21:18:29
Reply to
Derrick Stolee via GitGitGadget, 2021-03-16
From: Derrick Stolee <redacted>

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 <redacted>
---
 dir.c | 1 +
 1 file changed, 1 insertion(+)
diff --git a/dir.c b/dir.c
index 5b00dfb5b144..1c9f61566e66 100644
--- a/dir.c
+++ b/dir.c
@@ -3533,6 +3533,7 @@ static void connect_wt_gitdir_in_nested(const char *sub_worktree,
 	if (repo_read_index(&subrepo) < 0)
 		die(_("index file corrupt in repo %s"), subrepo.gitdir);
 
+	ensure_full_index(subrepo.index);
 	for (i = 0; i < subrepo.index->cache_nr; i++) {
 		const struct cache_entry *ce = subrepo.index->cache[i];
 
-- 
gitgitgadget
Thread (105 messages) 105 messages, 5 authors, 2021-04-13
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help