Fix leading slash bug when used with !.

When writing paths like `!/foo` in gitignore files (or when using the
-g/--glob flag), the presence of `!` would prevent the gitignore builder
from noticing the leading slash, which causes absolute path matching to
fail.

Fixes #405
This commit is contained in:
Andrew Gallant
2017-03-12 15:51:07 -04:00
parent d570f78144
commit 80e91a1f1d
3 changed files with 22 additions and 1 deletions

View File

@@ -214,4 +214,10 @@ mod tests {
assert!(ov.matched("src/foo", false).is_ignore());
assert!(ov.matched("src/foo", true).is_none());
}
#[test]
fn absolute_path() {
let ov = ov(&["!/bar"]);
assert!(ov.matched("./foo/bar", false).is_none());
}
}