MCPcopy Create free account
hub / github.com/AI45Lab/Code / matches_patterns

Function matches_patterns

core/src/context/ripgrep_provider.rs:367–377  ·  view source on GitHub ↗

Check if a path matches any of the given glob patterns

(path: &Path, patterns: &[String], default_if_empty: bool)

Source from the content-addressed store, hash-verified

365
366/// Check if a path matches any of the given glob patterns
367fn matches_patterns(path: &Path, patterns: &[String], default_if_empty: bool) -> bool {
368 if patterns.is_empty() {
369 return default_if_empty;
370 }
371 let path_str = path.to_string_lossy().replace('\\', "/");
372 patterns.iter().any(|pattern| {
373 glob::Pattern::new(pattern)
374 .map(|p| p.matches(&path_str))
375 .unwrap_or(false)
376 })
377}
378
379// ============================================================================
380// Tests

Callers 1

search_filesMethod · 0.85

Calls 2

is_emptyMethod · 0.45
matchesMethod · 0.45

Tested by

no test coverage detected