Skip to main content

pattern_matches

Function pattern_matches 

Source
pub fn pattern_matches(pattern: &str, path: &str) -> bool
Expand description

Simple glob pattern matching for CODEOWNERS patterns

Key rules:

  • Leading / anchors pattern to repository root
  • No leading /:
    • If ends with /: directory pattern, matches anywhere in tree
    • If contains /: implicitly anchored to root
    • If no / and has *: matches at any depth (e.g., *.rs)
    • If no / and no *: anchored to root
  • * matches any characters except /
  • ** matches zero or more directories