Skip to main content

find_ignored_paths_with_source

Function find_ignored_paths_with_source 

Source
pub fn find_ignored_paths_with_source(
    repo_root: &Path,
    rel_paths: &[String],
) -> FxHashMap<String, IgnoreSource>
Expand description

Returns the subset of rel_paths (repo-root-relative) excluded by either .gitignore (via git’s own engine, so nesting/negation/** are handled correctly) or .diffctx/ignore (patterns anchored per-directory and fed to git as a temporary core.excludesFile, so the same engine evaluates both mechanisms uniformly), mapped to the rule family that excluded each. Best-effort: any failure returns an empty map rather than blocking the diff pipeline on an ignore-resolution problem.

A .gitignore exclusion inherited from an excluded ancestor directory does NOT count. --no-index is required for .diffctx/ignore to apply to tracked files at all, but it also revives git’s rule that a file cannot be re-included once a parent directory is excluded. pandoc excludes every dotted root entry with /*.* and re-includes !.github/**: git keeps .github/workflows/ci.yml because it is tracked, while --no-index reports it ignored via the ancestor — which silently reduced a real change to an empty selection (#153). A pattern matching the path itself still excludes it, so .diffctx/ignore and per-directory .gitignore rules (#85) keep working.