mirror of
https://github.com/facebook/sapling.git
synced 2024-10-09 08:18:15 +03:00
e96c3e1ca7
Summary: Update the gitignore handling code to perform pattern matching the same way git does. Previously the code just called the standard fnmatch() function, which does not handle "**" in patterns the same way git does. This includes our own new implementation of glob pattern matching. I did evaluate several other options before writing our own implementation here: - The wildmatch() code used by git (and watchman, and rsync) has a few downsides: it is not distributed by itself as a library anywhere else. Therefore we would probably have to include a copy of this code in our repository. Making another copy is unfortunate, and somewhat undesirable from a legal and licensing perspective. This code also only works with nul-terminated strings, and our code deals primarily with non-terminated StringPiece objects. - I did look at translating glob patterns in to regular expressions and using re2 to perform matching. Unfortunately re2 turns out to be substantially slower than wildmatch() for typical gitignore patterns. This new implementation performs some preprocessing on the glob pattern, and generates a pattern opcode buffer. Eden can perform this glob preprocessing when it first loads a .gitignore file, and can then save and re-use this result each time it needs to match a filename. Doing this preprocessing allows matching to be done 50% to 100% faster than wildmatch() for typical glob patterns. Reviewed By: bolinfest Differential Revision: D4194573 fbshipit-source-id: 46bc6a61b6d8066f4bbdb5d3e74265a3e72e42cc |
||
---|---|---|
.. | ||
git | ||
hg | ||
test | ||
Blob.h | ||
Hash.cpp | ||
Hash.h | ||
TARGETS | ||
Tree.h | ||
TreeEntry.h |