summaryrefslogtreecommitdiff
path: root/list-objects.c
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2011-10-24 06:36:10 (GMT)
committerJunio C Hamano <gitster@pobox.com>2011-10-27 18:38:24 (GMT)
commitd688cf07b15b664a2164c3d92bcb5e8265400a2b (patch)
treee00f6633f9938ef2808bd2c25f71938b805f198a /list-objects.c
parent02cb67530e62e77d437cd68b4bb4307ab752b6a0 (diff)
downloadgit-d688cf07b15b664a2164c3d92bcb5e8265400a2b.zip
git-d688cf07b15b664a2164c3d92bcb5e8265400a2b.tar.gz
git-d688cf07b15b664a2164c3d92bcb5e8265400a2b.tar.bz2
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 'list-objects.c')
-rw-r--r--list-objects.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/list-objects.c b/list-objects.c
index 39d80c0..3dd4a96 100644
--- a/list-objects.c
+++ b/list-objects.c
@@ -71,7 +71,8 @@ static void process_tree(struct rev_info *revs,
struct tree_desc desc;
struct name_entry entry;
struct name_path me;
- int match = revs->diffopt.pathspec.nr == 0 ? 2 : 0;
+ enum interesting match = revs->diffopt.pathspec.nr == 0 ?
+ all_entries_interesting: entry_not_interesting;
int baselen = base->len;
if (!revs->tree_objects)
@@ -97,12 +98,12 @@ static void process_tree(struct rev_info *revs,
init_tree_desc(&desc, tree->buffer, tree->size);
while (tree_entry(&desc, &entry)) {
- if (match != 2) {
+ if (match != all_entries_interesting) {
match = tree_entry_interesting(&entry, base, 0,
&revs->diffopt.pathspec);
- if (match < 0)
+ if (match == all_entries_not_interesting)
break;
- if (match == 0)
+ if (match == entry_not_interesting)
continue;
}