diff options
author | Junio C Hamano <gitster@pobox.com> | 2011-12-14 10:02:51 +0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2011-12-14 10:02:51 +0400 |
commit | df6246ed78d040f06f095dd62d8db07a0aa19a96 (patch) | |
tree | cf9da0c48aa9450471d5c09a659cc99a1d3e1159 /builtin | |
parent | 8311158c66e0d83df950ea837fb1cb332c51f798 (diff) | |
parent | ea4f9685cb432caf357ad8af56a91877b6d04663 (diff) |
Merge branch 'nd/misc-cleanups' into maint
* 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')
-rw-r--r-- | builtin/grep.c | 11 | ||||
-rw-r--r-- | builtin/pack-objects.c | 2 |
2 files changed, 7 insertions, 6 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; } diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c index 824ecee20b..558cd34bcc 100644 --- a/builtin/pack-objects.c +++ b/builtin/pack-objects.c @@ -1015,7 +1015,7 @@ static void add_pbase_object(struct tree_desc *tree, while (tree_entry(tree,&entry)) { if (S_ISGITLINK(entry.mode)) continue; - cmp = tree_entry_len(entry.path, entry.sha1) != cmplen ? 1 : + cmp = tree_entry_len(&entry) != cmplen ? 1 : memcmp(name, entry.path, cmplen); if (cmp > 0) continue; |