Merge remote-tracking branch 'origin/main' into assistant-2
This commit is contained in:
commit
9eb98122ec
59 changed files with 4270 additions and 1325 deletions
|
@ -219,9 +219,11 @@ impl PathMatcher {
|
|||
}
|
||||
|
||||
pub fn is_match<P: AsRef<Path>>(&self, other: P) -> bool {
|
||||
other.as_ref().starts_with(&self.maybe_path)
|
||||
|| self.glob.is_match(&other)
|
||||
|| self.check_with_end_separator(other.as_ref())
|
||||
let other_path = other.as_ref();
|
||||
other_path.starts_with(&self.maybe_path)
|
||||
|| other_path.ends_with(&self.maybe_path)
|
||||
|| self.glob.is_match(other_path)
|
||||
|| self.check_with_end_separator(other_path)
|
||||
}
|
||||
|
||||
fn check_with_end_separator(&self, path: &Path) -> bool {
|
||||
|
@ -418,4 +420,14 @@ mod tests {
|
|||
"Path matcher {path_matcher} should match {path:?}"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn project_search() {
|
||||
let path = Path::new("/Users/someonetoignore/work/zed/zed.dev/node_modules");
|
||||
let path_matcher = PathMatcher::new("**/node_modules/**").unwrap();
|
||||
assert!(
|
||||
path_matcher.is_match(&path),
|
||||
"Path matcher {path_matcher} should match {path:?}"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue