[PATCH v2 11/25] grep: ensure full index
- From
Derrick Stolee via GitGitGadget <gitgitgadget@gmail.com>
- Date
- Apr 1, 2021, 01:49 UTC
- Message-ID
- <8c0d377054fa126f6b7426f8d87cd9bd57f5328c.1617241803.git.gitgitgadget@gmail.com>
- In-Reply-To
- <pull.906.v2.git.1617241802.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 | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/builtin/grep.c b/builtin/grep.c index 4e91a253ac3b..c2d40414e975 100644 --- a/builtin/grep.c +++ b/builtin/grep.c @@ -504,6 +504,8 @@ static int grep_cache(struct grep_opt *opt, if (repo_read_index(repo) < 0) die(_("index file corrupt")); + /* TODO: audit for interaction with sparse-index. */ + ensure_full_index(repo->index); for (nr = 0; nr < repo->index->cache_nr; nr++) { const struct cache_entry *ce = repo->index->cache[nr];
-- gitgitgadget