[PATCH 0/6] wildmatch part 2
- From
Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
- Date
- Oct 4, 2012, 07:39 UTC
- Message-ID
- <1349336392-1772-1-git-send-email-pclouds@gmail.com>
- In-Reply-To
- <7v626q3hen.fsf@alter.siamese.dyndns.org>
On Thu, Oct 4, 2012 at 1:01 PM, Junio C Hamano <gitster@pobox.com> wrote:
> Perhaps the wildmatch code may not be what we want X-<.
When I imported wildmatch I was hoping to make minimum changes to it. But wildmatch is probably the only practical way to support "**" even if we later need to change it the way we want. Other options are base our work on top of compat/fnmatch.c, which is an #ifdef spaghetti mess, or write a new fnmatch()-compatible function. Both unattractive to me.
Anyway, this is on top of nd/wildmatch, which makes "ab**cd" match full pathname.
attr patches port .gitignore optimizations over. In long term, we should probably have a shared matching implementation instead. I tried that road once and failed so I won't attempt again any time soon. If we drop wildmatch, I can split these attr patches out as a separate series. It's a good thing to do anyway.
The last patch just reflects that current "**" is not exactly what we want. I'm not sure if I could look into wildmatch.c and change it. Anybody is welcome to step up, of course.
Nguyễn Thái Ngọc Duy (6): attr: remove the union in struct match_attr attr: avoid strlen() on every match attr: avoid searching for basename on every match attr: more matching optimizations from .gitignore gitignore: do not do basename match with patterns that have '**' t3001: note about expected "**" behavior
Documentation/gitignore.txt | 10 ++-- attr.c | 101 +++++++++++++++++++++++++++---------- dir.c | 6 +-- dir.h | 2 + t/t0003-attributes.sh | 16 ++++++ t/t3001-ls-files-others-exclude.sh | 18 +++++++ 6 files changed, 118 insertions(+), 35 deletions(-)
-- 1.7.12.1.405.gb727dc9