TODOs and some cleanup/refactoring.

This commit is contained in:
Andrew Gallant
2016-09-05 10:15:13 -04:00
parent 812cdb13c6
commit d8d7560fd0
5 changed files with 70 additions and 53 deletions

View File

@@ -118,14 +118,8 @@ impl Gitignore {
/// of the directory containing this gitignore) is stripped. If there is
/// no common suffix/prefix overlap, then path is assumed to reside in the
/// same directory as this gitignore file.
///
/// If the given path has a `./` prefix then it is stripped before
/// matching.
pub fn matched<P: AsRef<Path>>(&self, path: P, is_dir: bool) -> Match {
let mut path = path.as_ref();
if let Ok(p) = path.strip_prefix("./") {
path = p;
}
if let Ok(p) = path.strip_prefix(&self.root) {
path = p;
}