pub fn foreign_lines_touching(path: &Path, axes: &[&str]) -> Result<Vec<String>>Expand description
Lines outside the managed section that touch one of axes.
The catch-all is one line among many, and git takes the last match — so
a line below the managed section saying secrets/** -filter, or setting
filter=lfs, turns this tool off for those paths. Measured on git 2.55:
git check-attr filter then reports unset, git add stores the plaintext,
and status — which only looked for the catch-all line — called the
repository healthy.
Reading only. The question “does any of this actually reach a declared path”
is answered by [FilterResolver], which runs git’s own attribute stack; what
this function contributes is the text of the offending lines, so a report can
show a reader what to delete instead of only telling them a path is
unfiltered.
axes names the attributes worth looking for — status asks about filter
alone, sync about the axes that can cost something. diff is deliberately
on nobody’s list: measured 2026-08-05, a foreign line setting diff=lfs,
-diff or diff on a declared path costs a readable git diff and not one
byte in the repository.
§Errors
Error::Io when the file exists but cannot be read, Error::Config when
it is not text.