Skip to content

Commit 46eb6e3

Browse files
derrickstoleegitster
authored andcommitted
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 <[email protected]> Reviewed-by: Elijah Newren <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 2227ea1 commit 46eb6e3

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

builtin/grep.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -504,6 +504,8 @@ static int grep_cache(struct grep_opt *opt,
504504
if (repo_read_index(repo) < 0)
505505
die(_("index file corrupt"));
506506

507+
/* TODO: audit for interaction with sparse-index. */
508+
ensure_full_index(repo->index);
507509
for (nr = 0; nr < repo->index->cache_nr; nr++) {
508510
const struct cache_entry *ce = repo->index->cache[nr];
509511

0 commit comments

Comments
 (0)