summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAndrew Gallant <jamslam@gmail.com>2016-10-16 10:15:11 -0400
committerAndrew Gallant <jamslam@gmail.com>2016-10-16 10:15:11 -0400
commitf2e1711781d245eca7bc9087fc833cf59af98a0b (patch)
treee49b35d6446f18d55cefe63feaf333c0d8cc6704 /tests
parent94d600e6e160c817176c48a07cb8ac1d29c553d7 (diff)
Fix bug when processing parent gitignore files.
This particular bug was triggered whenever a search was run in a directory with a parent directory that contains a relevant .gitignore file. In particular, before matching against a parent directory's gitignore rules, a path's leading `./` was not stripped, which results in errant matching. We now make sure `./` is stripped. Fixes #184.
Diffstat (limited to 'tests')
-rw-r--r--tests/tests.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/tests.rs b/tests/tests.rs
index d6fe35d2..a559045c 100644
--- a/tests/tests.rs
+++ b/tests/tests.rs
@@ -837,6 +837,20 @@ clean!(
assert_eq!(lines, TESTCASE);
});
+// See: https://github.com/BurntSushi/ripgrep/issues/184
+clean!(regression_184, "test", ".", |wd: WorkDir, mut cmd: Command| {
+ wd.create(".gitignore", ".*");
+ wd.create_dir("foo/bar");
+ wd.create("foo/bar/baz", "test");
+
+ let lines: String = wd.stdout(&mut cmd);
+ assert_eq!(lines, format!("{}:test\n", path("foo/bar/baz")));
+
+ cmd.current_dir(wd.path().join("./foo/bar"));
+ let lines: String = wd.stdout(&mut cmd);
+ assert_eq!(lines, "baz:test\n");
+});
+
// See: https://github.com/BurntSushi/ripgrep/issues/20
sherlock!(feature_20_no_filename, "Sherlock", ".",
|wd: WorkDir, mut cmd: Command| {