1
0
mirror of https://github.com/BurntSushi/ripgrep.git synced 2024-12-12 19:18:24 +02:00
Commit Graph

4 Commits

Author SHA1 Message Date
Andrew Gallant
45473ba48f
ignore/style: 80 columns, dammit 2018-07-29 08:31:04 -04:00
dana
51864c13fc ignore: fix handling of / in patterns
This commit makes handling of patterns containing a `/`
match actual git behaviour and the specification written
in `man gitignore`.

Fixes #761
2018-01-29 14:10:59 -05:00
Behnam Esfahbod
0668c74ed4 [ignore] Fix matched_path_or_any_parents() for patterns ending in slash
In `matched_path_or_any_parents()` implementation, we missed the point
that when we start walking up the tree, we have to set `is_dir` to
`true`, so path `ROOT/a/b/c` matches pattern `/a/`, although the
original path is not a dir.
2017-07-13 08:44:09 -04:00
Behnam Esfahbod ✅
84f4b4ef68 [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.
2017-07-12 22:06:08 -04:00