Skip to content

Commit e43e2a1

Browse files
derrickstoleegitster
authored andcommitted
rm: 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 299e2c4 commit e43e2a1

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

builtin/rm.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,8 @@ int cmd_rm(int argc, const char **argv, const char *prefix)
293293

294294
seen = xcalloc(pathspec.nr, 1);
295295

296+
/* TODO: audit for interaction with sparse-index. */
297+
ensure_full_index(&the_index);
296298
for (i = 0; i < active_nr; i++) {
297299
const struct cache_entry *ce = active_cache[i];
298300
if (!ce_path_match(&the_index, ce, &pathspec, seen))

0 commit comments

Comments
 (0)