diff options
| author | Derrick Stolee <dstolee@microsoft.com> | 2021-04-01 01:49:48 +0000 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2021-04-14 13:47:13 -0700 |
| commit | 46eb6e31ef01684ec2dc64f690a63446022940e5 (patch) | |
| tree | 76e4727615ea8f54ca91ebc12004bd1b57099e4d /builtin/grep.c | |
| parent | 2227ea175f9d2660c66f1bf15e2cd1ad75c9d4ca (diff) | |
| download | git-46eb6e31ef01684ec2dc64f690a63446022940e5.tar.gz | |
grep: ensure full index
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>
Reviewed-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/grep.c')
| -rw-r--r-- | builtin/grep.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/builtin/grep.c b/builtin/grep.c index 4e91a253ac..c2d40414e9 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]; |
