MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / normalize_pattern

Function normalize_pattern

atomic-repository/src/repository/ignore_mirror.rs:143–149  ·  view source on GitHub ↗

Normalize a pattern for representation comparison: strip a leading and a trailing slash so `.atomic` matches the anchored exclude line `/.atomic/`.

(pattern: &str)

Source from the content-addressed store, hash-verified

141/// Normalize a pattern for representation comparison: strip a leading and a
142/// trailing slash so `.atomic` matches the anchored exclude line `/.atomic/`.
143fn normalize_pattern(pattern: &str) -> &str {
144 pattern
145 .strip_prefix('/')
146 .unwrap_or(pattern)
147 .strip_suffix('/')
148 .unwrap_or(pattern)
149}
150
151/// Check ignore-policy parity without writing anything.
152///

Callers 1

check_ignore_policyFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected