Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2018-05-30 15:51:26 +0300
committerJunio C Hamano <gitster@pobox.com>2018-05-30 15:51:26 +0300
commit6ac5acae2d93f49f169d9b10dd9fcbce3fd874e2 (patch)
tree7e34be3530a42546d012609d214a80394bb1a25e
parentf15a486ca1dd67757cb6a3c0545dc2c6ef992bc3 (diff)
parentb2aa84c789a032c60b81d6ad68527e3a9076b99b (diff)
Merge branch 'sb/grep-die-on-unreadable-index'
Error behaviour of "git grep" when it cannot read the index was inconsistent with other commands that uses the index, which has been corrected to error out early. * sb/grep-die-on-unreadable-index: grep: handle corrupt index files early
-rw-r--r--builtin/grep.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/builtin/grep.c b/builtin/grep.c
index 6e7bc76785..69f0743619 100644
--- a/builtin/grep.c
+++ b/builtin/grep.c
@@ -488,7 +488,8 @@ static int grep_cache(struct grep_opt *opt, struct repository *repo,
strbuf_addstr(&name, repo->submodule_prefix);
}
- repo_read_index(repo);
+ if (repo_read_index(repo) < 0)
+ die("index file corrupt");
for (nr = 0; nr < repo->index->cache_nr; nr++) {
const struct cache_entry *ce = repo->index->cache[nr];