diff options
author | Junio C Hamano <gitster@pobox.com> | 2011-05-06 10:50:06 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2011-05-06 10:50:06 -0700 |
commit | 1273738f05dedc63865085deb5d1fb8816ff809c (patch) | |
tree | b63d47e65064ac061ed300c01ab26129a31db678 /builtin/grep.c | |
parent | 9fdc1cc872308869d76665be55367eef48f05ff6 (diff) | |
parent | 33e0f62ba981ebfdcab8c9fb6d2935712a7b9d41 (diff) | |
download | git-1273738f05dedc63865085deb5d1fb8816ff809c.tar.gz |
Merge branch 'nd/struct-pathspec'
* nd/struct-pathspec:
pathspec: rename per-item field has_wildcard to use_wildcard
Improve tree_entry_interesting() handling code
Convert read_tree{,_recursive} to support struct pathspec
Reimplement read_tree_recursive() using tree_entry_interesting()
Diffstat (limited to 'builtin/grep.c')
-rw-r--r-- | builtin/grep.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/builtin/grep.c b/builtin/grep.c index 10a1f65310..3ee2ec51de 100644 --- a/builtin/grep.c +++ b/builtin/grep.c @@ -533,18 +533,18 @@ 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, matched = 0; + int hit = 0, match = 0; struct name_entry entry; int old_baselen = base->len; while (tree_entry(tree, &entry)) { int te_len = tree_entry_len(entry.path, entry.sha1); - if (matched != 2) { - matched = tree_entry_interesting(&entry, base, tn_len, pathspec); - if (matched == -1) - break; /* no more matches */ - if (!matched) + if (match != 2) { + match = tree_entry_interesting(&entry, base, tn_len, pathspec); + if (match < 0) + break; + if (match == 0) continue; } |