From 46eb6e31ef01684ec2dc64f690a63446022940e5 Mon Sep 17 00:00:00 2001 From: Derrick Stolee Date: Thu, 1 Apr 2021 01:49:48 +0000 Subject: 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 4e91a25..c2d4041 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]; -- cgit v0.10.2-6-g49f6