[PATCH 11/27] grep: ensure full index
- From
Derrick Stolee via GitGitGadget <gitgitgadget@gmail.com>
- Date
- Mar 16, 2021, 21:16 UTC
- Message-ID
- <abe189051a0c6e4cb083ff3ab8a240fd375b2581.1615929436.git.gitgitgadget@gmail.com>
- In-Reply-To
- <pull.906.git.1615929435.gitgitgadget@gmail.com>
From: Derrick Stolee <dstolee@microsoft.com>
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 <dstolee@microsoft.com> --- 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