Gitattributes checker (exact git rules)

v1.0.0
io.github.Lawatch/gitattributes-check Checked 1 day ago Published 17 days ago

Which git attributes apply to a file (line endings, binary, LFS, linguist) and which line decides.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

check_attributes Which git attributes apply to this path?

Tells, exactly as `git check-attr -a` would, which attributes apply to each path (text, eol, binary, diff, merge, filter=lfs, export-ignore, linguist-*, any custom attribute), with the file and line that decides each one, and what that means in practice: line-ending conversion, binary diffs, Git LFS storage, files left out of release archives, GitHub language stats and collapsed generated files. Handles macros ([attr], built-in "binary"), set / -unset / !unspecified / value, nested .gitattributes files, .git/info/attributes, quoted patterns, and the trap that "dir/" never applies to the files…

ParameterTypeDescription
paths *arrayPaths relative to the repository root, with "/" separators. End a path with "/" if it is a directory.
attributesarrayOnly report these attributes (like `git check-attr text eol -- path`), including "unspecified" ones. Default: every attribute that is set, unset or has a value (like `git check-attr -a`).
filesobjectSeveral attribute files at once, as { "<path>": "<content>" }, e.g. { ".gitattributes": "...", "docs/.gitattributes": "...", ".git/info/attributes": "..." }. Paths are relative to the repository root.
gitattributesstringContent of the root .gitattributes file.

explain_gitattributes Explain a .gitattributes, line by line

Explains every line of one or more .gitattributes files in plain English and flags the classic mistakes: "dir/" patterns that never reach the files inside, negative "!" patterns (ignored by git), macros outside the root file, invalid attribute names that make git drop the whole line, unquoted patterns with spaces, Git LFS rules without -text, bad eol / text values, the old crlf attribute.

ParameterTypeDescription
filesobjectSeveral attribute files at once, as { "<path>": "<content>" }, e.g. { ".gitattributes": "...", "docs/.gitattributes": "...", ".git/info/attributes": "..." }. Paths are relative to the repository root.
gitattributesstringContent of the root .gitattributes file.