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

[PATCH 11/27] grep: ensure full index

flat view
STALE2028d 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 one so we do not miss blobs to scan. Later, this can
integrate more carefully with sparse indexes with proper testing.

Signed-off-by: Derrick Stolee <redacted>
---
 builtin/grep.c | 1 +
 1 file changed, 1 insertion(+)
diff --git a/builtin/grep.c b/builtin/grep.c
index 4e91a253ac3b..652d6d60f644 100644
--- a/builtin/grep.c
+++ b/builtin/grep.c
@@ -504,6 +504,7 @@ static int grep_cache(struct grep_opt *opt,
 	if (repo_read_index(repo) < 0)
 		die(_("index file corrupt"));
 
+	ensure_full_index(repo->index);
 	for (nr = 0; nr < repo->index->cache_nr; nr++) {
 		const struct cache_entry *ce = repo->index->cache[nr];
 
-- 
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