[ignore] Add extensive test for gitignore matching (#551)

[ignore] tests and new matched_path_or_any_parents method

The test data (gitignore rules and expected result) is based on the test
repo at <https://github.com/behnam/gitignore-test>.

The new `matched_path_or_any_parents` method fixes a bug
in gitignore matching where rules of form `<dir>/*` result in ignoring
only first-level files, but no deep files. This is not correct, as `<dir>/*`
matches the first-level directories under `<dir>`, resulting all to be
ignored. The new method fixes it by trying to match all parents in the
path against the gitignore rules.

The new method is necessary because it necessarily entails a
performance hit for trying to match all parents.
This commit is contained in:
Behnam Esfahbod ✅
2017-07-12 20:06:08 -06:00
committed by Andrew Gallant
parent aeac85389d
commit 84f4b4ef68
5 changed files with 524 additions and 3 deletions

View File

@@ -3,6 +3,7 @@ language: rust
env:
global:
- PROJECT_NAME=ripgrep
- RUST_BACKTRACE: full
matrix:
include:
# Nightly channel.