Gitattributes checker (exact git rules)
v1.0.0Which 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…
| Parameter | Type | Description |
|---|---|---|
paths * | array | Paths relative to the repository root, with "/" separators. End a path with "/" if it is a directory. |
attributes | array | Only 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`). |
files | object | Several attribute files at once, as { "<path>": "<content>" }, e.g. { ".gitattributes": "...", "docs/.gitattributes": "...", ".git/info/attributes": "..." }. Paths are relative to the repository root. |
gitattributes | string | Content 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.
| Parameter | Type | Description |
|---|---|---|
files | object | Several attribute files at once, as { "<path>": "<content>" }, e.g. { ".gitattributes": "...", "docs/.gitattributes": "...", ".git/info/attributes": "..." }. Paths are relative to the repository root. |
gitattributes | string | Content of the root .gitattributes file. |