prefix_pattern

Function prefix_pattern 

Source
pub fn prefix_pattern(project_path: &Path, pattern: &str) -> String
Expand description

Prefix a pattern with the project’s relative path.

This ensures patterns in nested projects correctly reference files from the repository root in the aggregated CODEOWNERS file.

§Examples

// Root project - patterns are normalized to start with /
prefix_pattern("", "*.rs") -> "/*.rs"
prefix_pattern(".", "/docs/**") -> "/docs/**"

// Nested project - patterns are prefixed with project path
prefix_pattern("services/api", "*.rs") -> "/services/api/*.rs"
prefix_pattern("services/api", "/src/**") -> "/services/api/src/**"