Re: [PATCH 12/19] tree_entry_interesting(): support wildcard matching
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Dec 13, 2010, 18:10 UTC
- Message-ID
- <7vaak935ob.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <1292233616-27692-13-git-send-email-pclouds@gmail.com>
Nguyễn Thái Ngọc Duy <pclouds@gmail.com> writes:
Show 5 quoted lines
> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> > --- > tree-walk.c | 33 ++++++++++++++++++++++++++++++--- > tree-walk.h | 2 +- > 2 files changed, 31 insertions(+), 4 deletions(-)
;-) Looks almost too easy.
Show 17 quoted lines
> diff --git a/tree-walk.c b/tree-walk.c > index d28de30..b5ad42b 100644 > --- a/tree-walk.c > +++ b/tree-walk.c > @@ -596,6 +598,31 @@ int tree_entry_interesting(const struct name_entry *entry, > &never_interesting)) > return 1; > } > + > +match_wildcards: > + /* > + * Concatenate base and entry->path into one and do > + * fnmatch() on it. > + */ > + > + if (!item->has_wildcard) > + continue;
I think the comment comes after this if--continue.
> + never_interesting = 0;
When we have wildcard we would want to disable the never-interesting optimization, but I wonder if doing so only when we do not have exact hit is what we want. If a sick person had a path "a?b" tracked, and asked to match a pathspec "a?b", don't we still want to say "'a?b' of course matches, but 'a1b' ('1' comes earlier than '?' in the sort order) and 'aAb' ('A' comes later) also match"?