aboutsummaryrefslogtreecommitdiff
path: root/tree.c
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2011-10-24 17:36:10 +1100
committerJunio C Hamano <gitster@pobox.com>2011-10-27 11:38:24 -0700
commitd688cf07b15b664a2164c3d92bcb5e8265400a2b (patch)
treee00f6633f9938ef2808bd2c25f71938b805f198a /tree.c
parent02cb67530e62e77d437cd68b4bb4307ab752b6a0 (diff)
downloadgit-d688cf07b15b664a2164c3d92bcb5e8265400a2b.tar.gz
git-d688cf07b15b664a2164c3d92bcb5e8265400a2b.tar.xz
tree_entry_interesting(): give meaningful names to return values
It is a basic code hygiene to avoid magic constants that are unnamed. Besides, this helps extending the value later on for "interesting, but cannot decide if the entry truely matches yet" (ie. prefix matches) Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'tree.c')
-rw-r--r--tree.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/tree.c b/tree.c
index e62219803..676e9f710 100644
--- a/tree.c
+++ b/tree.c
@@ -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;
}