diff options
| author | Junio C Hamano <gitster@pobox.com> | 2011-12-13 22:02:51 -0800 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2011-12-13 22:02:51 -0800 |
| commit | df6246ed78d040f06f095dd62d8db07a0aa19a96 (patch) | |
| tree | cf9da0c48aa9450471d5c09a659cc99a1d3e1159 /tree.c | |
| parent | 8311158c66e0d83df950ea837fb1cb332c51f798 (diff) | |
| parent | ea4f9685cb432caf357ad8af56a91877b6d04663 (diff) | |
| download | git-df6246ed78d040f06f095dd62d8db07a0aa19a96.tar.xz | |
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 'tree.c')
| -rw-r--r-- | tree.c | 11 |
1 files changed, 6 insertions, 5 deletions
@@ -52,7 +52,8 @@ static int read_tree_1(struct tree *tree, struct strbuf *base, struct tree_desc desc; struct name_entry entry; unsigned char sha1[20]; - int len, retval = 0, oldlen = base->len; + int len, oldlen = base->len; + enum interesting retval = entry_not_interesting; if (parse_tree(tree)) return -1; @@ -60,11 +61,11 @@ static int read_tree_1(struct tree *tree, struct strbuf *base, init_tree_desc(&desc, tree->buffer, tree->size); while (tree_entry(&desc, &entry)) { - if (retval != 2) { + if (retval != all_entries_interesting) { retval = tree_entry_interesting(&entry, base, 0, pathspec); - if (retval < 0) + if (retval == all_entries_not_interesting) break; - if (retval == 0) + if (retval == entry_not_interesting) continue; } @@ -99,7 +100,7 @@ static int read_tree_1(struct tree *tree, struct strbuf *base, else continue; - len = tree_entry_len(entry.path, entry.sha1); + len = tree_entry_len(&entry); strbuf_add(base, entry.path, len); strbuf_addch(base, '/'); retval = read_tree_1(lookup_tree(sha1), |
