MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / path_patterns_can_overlap

Function path_patterns_can_overlap

crates/openshell-providers/src/profiles.rs:1563–1581  ·  view source on GitHub ↗
(first: &str, second: &str)

Source from the content-addressed store, hash-verified

1561}
1562
1563fn path_patterns_can_overlap(first: &str, second: &str) -> bool {
1564 if path_matches_all(first) || path_matches_all(second) {
1565 return true;
1566 }
1567 if !first.contains('*') {
1568 return endpoint_path_matches(second, first);
1569 }
1570 if !second.contains('*') {
1571 return endpoint_path_matches(first, second);
1572 }
1573 match (path_prefix_pattern(first), path_prefix_pattern(second)) {
1574 (Some(first_prefix), Some(second_prefix)) => {
1575 first_prefix == second_prefix
1576 || first_prefix.starts_with(&format!("{second_prefix}/"))
1577 || second_prefix.starts_with(&format!("{first_prefix}/"))
1578 }
1579 _ => true,
1580 }
1581}
1582
1583fn path_matches_all(path: &str) -> bool {
1584 path.is_empty() || path == "**" || path == "/**"

Calls 3

path_matches_allFunction · 0.70
endpoint_path_matchesFunction · 0.70
path_prefix_patternFunction · 0.70

Tested by

no test coverage detected