summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAndrew Gallant <jamslam@gmail.com>2016-09-24 19:44:06 -0400
committerAndrew Gallant <jamslam@gmail.com>2016-09-24 19:44:06 -0400
commit71ad9bf393a3d89f8c6395d963d9329f1a271d81 (patch)
treefee9e301f16204e481fb6614e96cb9e7eb12a4f4 /tests
parentf733e9ebe4a3c2a1aeedcbb0471423131885c8a5 (diff)
Fix trailing recursive globs in gitignore.
A standard glob of `foo/**` will match `foo`, but gitignore semantics specify that `foo/**` should only match the contents of `foo` and not `foo` itself. We capture those semantics by translating `foo/**` to `foo/**/*`. Fixes #30.
Diffstat (limited to 'tests')
-rw-r--r--tests/tests.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/tests.rs b/tests/tests.rs
index 4ffda0d6..5d4c41a9 100644
--- a/tests/tests.rs
+++ b/tests/tests.rs
@@ -625,6 +625,17 @@ clean!(regression_25, "test", ".", |wd: WorkDir, mut cmd: Command| {
assert_eq!(lines, expected);
});
+// See: https://github.com/BurntSushi/ripgrep/issues/30
+clean!(regression_30, "test", ".", |wd: WorkDir, mut cmd: Command| {
+ wd.create(".gitignore", "vendor/**\n!vendor/manifest");
+ wd.create_dir("vendor");
+ wd.create("vendor/manifest", "test");
+
+ let lines: String = wd.stdout(&mut cmd);
+ let expected = "vendor/manifest:test\n";
+ assert_eq!(lines, expected);
+});
+
// See: https://github.com/BurntSushi/ripgrep/issues/49
clean!(regression_49, "xyz", ".", |wd: WorkDir, mut cmd: Command| {
wd.create(".gitignore", "foo/bar");