diff options
author | Junio C Hamano <gitster@pobox.com> | 2011-12-05 15:10:20 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2011-12-05 15:10:20 -0800 |
commit | 62cdb6b23a7c6cf527d8f8c470c7d463f6ca9f6d (patch) | |
tree | fdcb93f4cd15caafa1aa7f506202e7f42ff30c7c /builtin/grep.c | |
parent | 9a6e2d77e91af34ebc6679ba3250524504083284 (diff) | |
parent | ea4f9685cb432caf357ad8af56a91877b6d04663 (diff) | |
download | git-62cdb6b23a7c6cf527d8f8c470c7d463f6ca9f6d.tar.gz |
Merge branch 'nd/misc-cleanups'
* nd/misc-cleanups:
unpack_object_header_buffer(): clear the size field upon error
tree_entry_interesting: make use of local pointer "item"
tree_entry_interesting(): give meaningful names to return values
read_directory_recursive: reduce one indentation level
get_tree_entry(): do not call find_tree_entry() on an empty tree
tree-walk.c: do not leak internal structure in tree_entry_len()
Diffstat (limited to 'builtin/grep.c')
-rw-r--r-- | builtin/grep.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/builtin/grep.c b/builtin/grep.c index 3d7329d78c..988ea1d332 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; } |