From: Derrick Stolee Date: Thu, 1 Apr 2021 01:49:51 +0000 (+0000) Subject: rm: ensure full index X-Git-Tag: v2.32.0-rc0~59^2~12 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e43e2a17d2d4f63a277a7fdbc32453876c25e06c;p=thirdparty%2Fgit.git 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 Reviewed-by: Elijah Newren Signed-off-by: Junio C Hamano --- diff --git a/builtin/rm.c b/builtin/rm.c index 4858631e0f..5559a0b453 100644 --- a/builtin/rm.c +++ b/builtin/rm.c @@ -293,6 +293,8 @@ int cmd_rm(int argc, const char **argv, const char *prefix) seen = xcalloc(pathspec.nr, 1); + /* TODO: audit for interaction with sparse-index. */ + ensure_full_index(&the_index); for (i = 0; i < active_nr; i++) { const struct cache_entry *ce = active_cache[i]; if (!ce_path_match(&the_index, ce, &pathspec, seen))