Thread (105 messages) 105 messages, 5 authors, 2021-04-13

[PATCH 14/27] rm: ensure full index

flat view
STALE2027d SUPERSEDED

From: Derrick Stolee via GitGitGadget <hidden>
Date: 2021-03-16 21:18:28
Subsystem: the rest · Maintainer: Linus Torvalds

Status: Superseded by v3 (posted 2021-04-12). [go to v3]

Revision v1 (3 revisions archived).

Revisions (3)
  1. v1 current
  2. v2 [diff against previous]
  3. v3 [diff against previous]
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>
---
 builtin/rm.c | 1 +
 1 file changed, 1 insertion(+)
diff --git a/builtin/rm.c b/builtin/rm.c
index 4858631e0f02..99125ccb8424 100644
--- a/builtin/rm.c
+++ b/builtin/rm.c
@@ -293,6 +293,7 @@ int cmd_rm(int argc, const char **argv, const char *prefix)
 
 	seen = xcalloc(pathspec.nr, 1);
 
+	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))
-- 
gitgitgadget
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help