Skip to content

Commit 42f44e8

Browse files
derrickstoleegitster
authored andcommitted
ls-files: ensure full index
Before iterating over all cache entries, ensure that a sparse index is expanded to a full one to avoid missing files. Signed-off-by: Derrick Stolee <[email protected]> Reviewed-by: Elijah Newren <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 46eb6e3 commit 42f44e8

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

builtin/ls-files.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,8 @@ static void show_files(struct repository *repo, struct dir_struct *dir)
317317

318318
if (!(show_cached || show_stage || show_deleted || show_modified))
319319
return;
320+
/* TODO: audit for interaction with sparse-index. */
321+
ensure_full_index(repo->index);
320322
for (i = 0; i < repo->index->cache_nr; i++) {
321323
const struct cache_entry *ce = repo->index->cache[i];
322324
struct stat st;
@@ -494,6 +496,8 @@ void overlay_tree_on_index(struct index_state *istate,
494496
die("bad tree-ish %s", tree_name);
495497

496498
/* Hoist the unmerged entries up to stage #3 to make room */
499+
/* TODO: audit for interaction with sparse-index. */
500+
ensure_full_index(istate);
497501
for (i = 0; i < istate->cache_nr; i++) {
498502
struct cache_entry *ce = istate->cache[i];
499503
if (!ce_stage(ce))

0 commit comments

Comments
 (0)