summaryrefslogtreecommitdiffstats
path: root/ignore/src/overrides.rs
diff options
context:
space:
mode:
authorAndrew Gallant <jamslam@gmail.com>2017-03-12 15:51:07 -0400
committerAndrew Gallant <jamslam@gmail.com>2017-03-12 15:51:17 -0400
commit80e91a1f1d725eb8e331f3613a352edb8b13677b (patch)
tree981ef24eabd2545b82599e16a99b07808972cf4c /ignore/src/overrides.rs
parentd570f78144b8fb63d02382630d10d5db174d21ce (diff)
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
Diffstat (limited to 'ignore/src/overrides.rs')
-rw-r--r--ignore/src/overrides.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/ignore/src/overrides.rs b/ignore/src/overrides.rs
index c737b04e..faf05f31 100644
--- a/ignore/src/overrides.rs
+++ b/ignore/src/overrides.rs
@@ -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());
+ }
}