summaryrefslogtreecommitdiff
path: root/list-objects.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2011-05-06 10:50:06 -0700
committerJunio C Hamano <gitster@pobox.com>2011-05-06 10:50:06 -0700
commit1273738f05dedc63865085deb5d1fb8816ff809c (patch)
treeb63d47e65064ac061ed300c01ab26129a31db678 /list-objects.c
parent9fdc1cc872308869d76665be55367eef48f05ff6 (diff)
parent33e0f62ba981ebfdcab8c9fb6d2935712a7b9d41 (diff)
downloadgit-1273738f05dedc63865085deb5d1fb8816ff809c.tar.gz
Merge branch 'nd/struct-pathspec'
* nd/struct-pathspec: pathspec: rename per-item field has_wildcard to use_wildcard Improve tree_entry_interesting() handling code Convert read_tree{,_recursive} to support struct pathspec Reimplement read_tree_recursive() using tree_entry_interesting()
Diffstat (limited to 'list-objects.c')
-rw-r--r--list-objects.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/list-objects.c b/list-objects.c
index 838b6a732e..0fb44e7ed7 100644
--- a/list-objects.c
+++ b/list-objects.c
@@ -68,7 +68,7 @@ static void process_tree(struct rev_info *revs,
struct tree_desc desc;
struct name_entry entry;
struct name_path me;
- int all_interesting = (revs->diffopt.pathspec.nr == 0);
+ int match = revs->diffopt.pathspec.nr == 0 ? 2 : 0;
int baselen = base->len;
if (!revs->tree_objects)
@@ -85,7 +85,7 @@ static void process_tree(struct rev_info *revs,
me.elem = name;
me.elem_len = strlen(name);
- if (!all_interesting) {
+ if (!match) {
strbuf_addstr(base, name);
if (base->len)
strbuf_addch(base, '/');
@@ -94,17 +94,13 @@ static void process_tree(struct rev_info *revs,
init_tree_desc(&desc, tree->buffer, tree->size);
while (tree_entry(&desc, &entry)) {
- if (!all_interesting) {
- int showit = tree_entry_interesting(&entry,
- base, 0,
- &revs->diffopt.pathspec);
-
- if (showit < 0)
+ if (match != 2) {
+ match = tree_entry_interesting(&entry, base, 0,
+ &revs->diffopt.pathspec);
+ if (match < 0)
break;
- else if (!showit)
+ if (match == 0)
continue;
- else if (showit == 2)
- all_interesting = 1;
}
if (S_ISDIR(entry.mode))