diff options
Diffstat (limited to 'builtin/grep.c')
-rw-r--r-- | builtin/grep.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/builtin/grep.c b/builtin/grep.c index 6e7bc76785..ee753a403e 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]; @@ -885,9 +886,9 @@ int cmd_grep(int argc, const char **argv, const char *prefix) N_("indicate hit with exit status without output")), OPT_BOOL(0, "all-match", &opt.all_match, N_("show only matches from files that match all patterns")), - { OPTION_SET_INT, 0, "debug", &opt.debug, NULL, - N_("show parse tree for grep expression"), - PARSE_OPT_NOARG | PARSE_OPT_HIDDEN, NULL, 1 }, + OPT_SET_INT_F(0, "debug", &opt.debug, + N_("show parse tree for grep expression"), + 1, PARSE_OPT_HIDDEN), OPT_GROUP(""), { OPTION_STRING, 'O', "open-files-in-pager", &show_in_pager, N_("pager"), N_("show matching files in the pager"), |