X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=builtin%2Fgrep.c;h=988ea1d3324d6e32fcfd3b97da0fad5ae41b592c;hb=6c41e97557d94df7085e3c0cff247305c9401968;hp=3d7329d78c6e3ec31ed8ce03b8928c9ed24afb9e;hpb=14ba45a2e68c296cb2b5bc5e77fdaa0846fb77de;p=git.git diff --git a/builtin/grep.c b/builtin/grep.c index 3d7329d78..988ea1d33 100644 --- a/builtin/grep.c +++ b/builtin/grep.c @@ -557,18 +557,19 @@ static int grep_cache(struct grep_opt *opt, const struct pathspec *pathspec, int static int grep_tree(struct grep_opt *opt, const struct pathspec *pathspec, struct tree_desc *tree, struct strbuf *base, int tn_len) { - int hit = 0, match = 0; + int hit = 0; + enum interesting match = entry_not_interesting; struct name_entry entry; int old_baselen = base->len; while (tree_entry(tree, &entry)) { - int te_len = tree_entry_len(entry.path, entry.sha1); + int te_len = tree_entry_len(&entry); - if (match != 2) { + if (match != all_entries_interesting) { match = tree_entry_interesting(&entry, base, tn_len, pathspec); - if (match < 0) + if (match == all_entries_not_interesting) break; - if (match == 0) + if (match == entry_not_interesting) continue; }