Implements the Git.Command behaviour for git check-attr.
Reports the gitattributes that apply to given paths. This is the
attributes analogue of Git.Commands.CheckIgnore.
Pass explicit attribute names in :attrs, or set :all to report every
attribute that is set on each path. :cached reads .gitattributes from
the index instead of the working tree.
Output is always requested with -z (NUL-delimited records) so paths and
values containing spaces or newlines parse unambiguously.
Stdin mode (--stdin) is intentionally not supported because it requires
stdin piping which cannot be driven programmatically via System.cmd/3.
Summary
Types
Functions
Returns the argument list for git check-attr.
Attributes and paths are separated with -- so paths are never mistaken
for attribute names.
Examples
iex> Git.Commands.CheckAttr.args(%Git.Commands.CheckAttr{attrs: ["diff"], paths: ["foo.ex"]})
["check-attr", "-z", "diff", "--", "foo.ex"]
iex> Git.Commands.CheckAttr.args(%Git.Commands.CheckAttr{attrs: ["diff", "text"], paths: ["foo.ex", "bar.png"]})
["check-attr", "-z", "diff", "text", "--", "foo.ex", "bar.png"]
iex> Git.Commands.CheckAttr.args(%Git.Commands.CheckAttr{all: true, paths: ["foo.ex"]})
["check-attr", "-z", "-a", "--", "foo.ex"]
iex> Git.Commands.CheckAttr.args(%Git.Commands.CheckAttr{attrs: ["diff"], paths: ["foo.ex"], cached: true})
["check-attr", "-z", "--cached", "diff", "--", "foo.ex"]
@spec parse_output(String.t(), non_neg_integer()) :: {:ok, [attribute()]} | {:error, {String.t(), non_neg_integer()}}
Parses the -z output of git check-attr.
Returns {:ok, [record]} where each record is a map with :path, :attr,
and :value keys. :value is the raw info string reported by git: one of
"set", "unset", "unspecified", or a custom attribute value.
Empty output (for example --all on a path with no attributes) returns
{:ok, []}. A non-zero exit code is a real error (unknown option, no
attribute specified, and so on) and returns {:error, {stdout, exit_code}}.