Skip to content

top-level gitignore considered less harmful

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 Latest3 patches 10 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3Unindent excluded_from_list()dir.c+48 -480 replies
2/3exclude: do strcmp as much as possible before fnmatchdir.c dir.h+28 -157 replies
3/3exclude: reduce computation cost on checking dirname in patternsdir.c dir.h+57 -10 replies

Reviews trailers per patch

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

Read the v1 thread

Cover letter [PATCH WIP 0/3] top-level gitignore considered less harmful

While my mind is still fresh on exclude stuff, let's do something to improve the big top-level gitignore situation [1].

The last patch is the real meat, where it assumes caller calls it on a series of pathnames of the same dirname. It'll cache strcmp result of the dirname part so we only pay the cost once per pattern for all entries in the same directory.

The result is not so impressive (i'm on -O0 though). Old webkit.git, before:

real    0m6.418s
user    0m5.561s
sys     0m0.827s

after:

real    0m5.262s
user    0m4.407s
sys     0m0.850s

We could approach the problem a different way instead: push back as much dirname as possible back to "(struct exclude*)->base", but I'm afraid that may mess thing up with all the pushing/popping in prep_exclude.

Also about that, we should not need to call prep_exclude() on every pathname, at least when the caller is {fill,read}_directory().

There's another optimaztion we could do to pay even less. If users sort the exclude patterns, if we check dirname of one pattern and the next pattern shares the same dirname, skip comparing what we have compared again.

The same can be done on "base" (even easier because we can just compare base pointer to know if they are the same) but "base" is for non-top-level gitignore.

[1] http://thread.gmane.org/gmane.comp.version-control.git/194294

Nguyễn Thái Ngọc Duy (3):
Unindent excluded_from_list()
exclude: do strcmp as much as possible before fnmatch
exclude: reduce computation cost on checking dirname in patterns

 dir.c | 166 ++++++++++++++++++++++++++++++++++++++++++++++--------------------
 dir.h |   5 +-
 2 files changed, 120 insertions(+), 51 deletions(-)
Signature · 1 line
1.7.10.2.549.g9354186