From: Derrick Stolee Date: Thu, 1 Apr 2021 01:49:48 +0000 (+0000) Subject: grep: ensure full index X-Git-Tag: v2.32.0-rc0~59^2~15 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=46eb6e31ef01684ec2dc64f690a63446022940e5;p=thirdparty%2Fgit.git 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 Reviewed-by: Elijah Newren Signed-off-by: Junio C Hamano --- 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];