Skip to main content

is_ignored

Function is_ignored 

Source
pub fn is_ignored(
    gi: &Gitignore,
    source: &Utf8Path,
    path: &Utf8Path,
    is_dir: bool,
) -> bool
Expand description

Test a path against the loaded .yuiignore matcher.

path is treated relative to source (gitignore convention). Paths that don’t live under source can’t possibly match a source-rooted rule, so they short-circuit to false. Without this guard, an absolute path passed through unwrap_or(path) would land on the matcher as an absolute, which Gitignore would test using its rightmost component — leading to spurious matches for paths outside the repo. (Caught in PR #19 review.)

Uses matched_path_or_any_parents so an ignored ancestor directory causes the descendant file to be ignored too.