Skip to content

wildmatch part 2

Nguyễn Thái Ngọc Duy git 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest6 patches 5 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/6attr: remove the union in struct match_attrattr.c+12 -130 replies
2/6attr: avoid strlen() on every matchattr.c+4 -20 replies
3/6attr: avoid searching for basename on every matchattr.c+9 -60 replies
4/6attr: more matching optimizations from .gitignoreattr.c dir.c dir.h+57 -120 replies
5/6gitignore: do not do basename match with patterns that have '**'Documentation/gitignore.txt attr.c dir.c +2 more+33 -73 replies
6/6t3001: note about expected "**" behaviort/t3001-ls-files-others-exclude.sh+8 -01 reply

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/6] wildmatch part 2
Quoted 1 line · Junio C Hamano

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(-)
Signature · 1 line
1.7.12.1.405.gb727dc9