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.
This commit is contained in:
Andrew Gallant
2016-09-24 19:44:06 -04:00
parent f733e9ebe4
commit 71ad9bf393
3 changed files with 19 additions and 10 deletions

View File

@@ -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");