Skip to main content

paths_match

Function paths_match 

Source
pub fn paths_match(
    paths: &[&str],
    files: &[&str],
) -> Result<Option<(usize, usize)>, Error>
Expand description

Evaluate a set of patterns against a set of files with negation (!) support.

Unlike path_matches, which evaluates a single pattern in isolation, this treats paths as an ordered group in the same way GitHub applies path filters: patterns are checked sequentially per file, and a pattern starting with ! re-excludes any file previously matched by an earlier pattern. A later positive pattern can re-include a file that was excluded by a negation.

Returns Ok(Some((path_index, file_index))) for the first file that ends up included, where path_index is the index of the last positive pattern that matched it. Returns Ok(None) when no file remains included after applying all patterns.