Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
Merge branch 'sb/grep-die-on-unreadable-index'
author
Junio C Hamano
<gitster@pobox.com>
Wed, 30 May 2018 12:51:26 +0000
(21:51 +0900)
committer
Junio C Hamano
<gitster@pobox.com>
Wed, 30 May 2018 12:51:26 +0000
(21:51 +0900)
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
builtin/grep.c
patch
|
blob
|
history
raw
(from parent 1:
f15a486
)
diff --git
a/builtin/grep.c
b/builtin/grep.c
index 6e7bc76785ace33f80251edfcc4feac8ad19d7c5..69f0743619f3134df44c94912dfd1e1c43f5fdc5 100644
(file)
--- 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];