<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sect2 SYSTEM "../../../dtd/dblite.dtd">

<sect2 lang="en" id="git-check-attr(1)">
    <title>git-check-attr(1)</title>
    <date>2024-07-02</date>
<revhistory><revision><date>2024-07-02</date></revision></revhistory>
<indexterm>
<primary>git-check-attr(1)</primary>
</indexterm>
<simplesect id="git-check-attr(1)__name">
<title>NAME</title>
<simpara>git-check-attr - Display gitattributes information</simpara>
</simplesect>
<simplesect id="git-check-attr(1)__synopsis">
<title>SYNOPSIS</title>
<blockquote>
<literallayout><emphasis>git check-attr</emphasis> [--source &lt;tree-ish&gt;] [-a | --all | &lt;attr&gt;&#8230;] [--] &lt;pathname&gt;&#8230;
<emphasis>git check-attr</emphasis> --stdin [-z] [--source &lt;tree-ish&gt;] [-a | --all | &lt;attr&gt;&#8230;]</literallayout>
</blockquote>
</simplesect>
<simplesect id="git-check-attr(1)__description">
<title>DESCRIPTION</title>
<simpara>For every pathname, this command will list if each attribute is <emphasis>unspecified</emphasis>,
<emphasis>set</emphasis>, or <emphasis>unset</emphasis> as a gitattribute on that pathname.</simpara>
</simplesect>
<simplesect id="git-check-attr(1)__options">
<title>OPTIONS</title>
<variablelist>
<varlistentry>
<term>
-a, --all
</term>
<listitem>
<simpara>
        List all attributes that are associated with the specified
        paths.  If this option is used, then <emphasis>unspecified</emphasis> attributes
        will not be included in the output.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--cached
</term>
<listitem>
<simpara>
        Consider <emphasis>.gitattributes</emphasis> in the index only, ignoring the working tree.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--stdin
</term>
<listitem>
<simpara>
        Read pathnames from the standard input, one per line,
        instead of from the command line.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
-z
</term>
<listitem>
<simpara>
        The output format is modified to be machine-parsable.
        If <emphasis>--stdin</emphasis> is also given, input paths are separated
        with a NUL character instead of a linefeed character.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--source=&lt;tree-ish&gt;
</term>
<listitem>
<simpara>
        Check attributes against the specified tree-ish. It is common to
        specify the source tree by naming a commit, branch, or tag associated
        with it.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--
</term>
<listitem>
<simpara>
        Interpret all preceding arguments as attributes and all following
        arguments as path names.
</simpara>
</listitem>
</varlistentry>
</variablelist>
<simpara>If none of <emphasis>--stdin</emphasis>, <emphasis>--all</emphasis>, or <emphasis>--</emphasis> is used, the first argument
will be treated as an attribute and the rest of the arguments as
pathnames.</simpara>
</simplesect>
<simplesect id="git-check-attr(1)__output">
<title>OUTPUT</title>
<simpara>The output is of the form:
&lt;path&gt; COLON SP &lt;attribute&gt; COLON SP &lt;info&gt; LF</simpara>
<simpara>unless <emphasis>-z</emphasis> is in effect, in which case NUL is used as delimiter:
&lt;path&gt; NUL &lt;attribute&gt; NUL &lt;info&gt; NUL</simpara>
<simpara>&lt;path&gt; is the path of a file being queried, &lt;attribute&gt; is an attribute
being queried, and &lt;info&gt; can be either:</simpara>
<variablelist>
<varlistentry>
<term>
<emphasis>unspecified</emphasis>
</term>
<listitem>
<simpara>
when the attribute is not defined for the path.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<emphasis>unset</emphasis>
</term>
<listitem>
<simpara>
when the attribute is defined as false.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<emphasis>set</emphasis>
</term>
<listitem>
<simpara>
when the attribute is defined as true.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
&lt;value&gt;
</term>
<listitem>
<simpara>
when a value has been assigned to the attribute.
</simpara>
</listitem>
</varlistentry>
</variablelist>
<simpara>Buffering happens as documented under the <emphasis>GIT_FLUSH</emphasis> option in
<xref linkend="git(1)" />.  The caller is responsible for avoiding deadlocks
caused by overfilling an input buffer or reading from an empty output
buffer.</simpara>
</simplesect>
<simplesect id="git-check-attr(1)__examples">
<title>EXAMPLES</title>
<simpara>In the examples, the following <emphasis>.gitattributes</emphasis> file is used:</simpara>
<screen>*.java diff=java -crlf myAttr
NoMyAttr.java !myAttr
README caveat=unspecified</screen>
<itemizedlist>
<listitem>
<simpara>
Listing a single attribute:
</simpara>
</listitem>
</itemizedlist>
<screen>$ git check-attr diff org/example/MyClass.java
org/example/MyClass.java: diff: java</screen>
<itemizedlist>
<listitem>
<simpara>
Listing multiple attributes for a file:
</simpara>
</listitem>
</itemizedlist>
<screen>$ git check-attr crlf diff myAttr -- org/example/MyClass.java
org/example/MyClass.java: crlf: unset
org/example/MyClass.java: diff: java
org/example/MyClass.java: myAttr: set</screen>
<itemizedlist>
<listitem>
<simpara>
Listing all attributes for a file:
</simpara>
</listitem>
</itemizedlist>
<screen>$ git check-attr --all -- org/example/MyClass.java
org/example/MyClass.java: diff: java
org/example/MyClass.java: myAttr: set</screen>
<itemizedlist>
<listitem>
<simpara>
Listing an attribute for multiple files:
</simpara>
</listitem>
</itemizedlist>
<screen>$ git check-attr myAttr -- org/example/MyClass.java org/example/NoMyAttr.java
org/example/MyClass.java: myAttr: set
org/example/NoMyAttr.java: myAttr: unspecified</screen>
<itemizedlist>
<listitem>
<simpara>
Not all values are equally unambiguous:
</simpara>
</listitem>
</itemizedlist>
<screen>$ git check-attr caveat README
README: caveat: unspecified</screen>
</simplesect>
<simplesect id="git-check-attr(1)__see_also">
<title>SEE ALSO</title>
<simpara><xref linkend="gitattributes(5)" />.</simpara>
</simplesect>
<simplesect id="git-check-attr(1)__git">
<title>GIT</title>
<simpara>Part of the <xref linkend="git(1)" /> suite</simpara>
</simplesect>
</sect2>
