sapling/eden/fs/model
Adam Simpkins e96c3e1ca7 fully implement gitignore glob pattern matching
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
2016-11-21 15:26:07 -08:00
..
git fully implement gitignore glob pattern matching 2016-11-21 15:26:07 -08:00
hg Allow initial state for Dirstate to be passed to the constructor. 2016-11-18 19:26:04 -08:00
test Introduce TreeEntry.getMode() because getOwnerPermissions() was not doing the expected thing. 2016-10-19 10:54:11 -07:00
Blob.h Initial commit 2016-05-12 14:09:13 -07:00
Hash.cpp Make facebook::eden::Hash hashable. 2016-10-12 15:53:30 -07:00
Hash.h Make facebook::eden::Hash hashable. 2016-10-12 15:53:30 -07:00
TARGETS Wrappers for some of OpenSSL's crypto hash functions 2016-06-16 18:30:50 -07:00
Tree.h make put and get for trees/blobs symmetric 2016-07-25 12:34:25 -07:00
TreeEntry.h Introduce TreeEntry.getMode() because getOwnerPermissions() was not doing the expected thing. 2016-10-19 10:54:11 -07:00