Start the 2.46 cycle
[git.git] / Documentation / git-check-attr.txt
blobcb5a6c8f335e128408e9b6b54cbb4037751e7932
1 git-check-attr(1)
2 =================
4 NAME
5 ----
6 git-check-attr - Display gitattributes information
9 SYNOPSIS
10 --------
11 [verse]
12 'git check-attr' [--source <tree-ish>] [-a | --all | <attr>...] [--] <pathname>...
13 'git check-attr' --stdin [-z] [--source <tree-ish>] [-a | --all | <attr>...]
15 DESCRIPTION
16 -----------
17 For every pathname, this command will list if each attribute is 'unspecified',
18 'set', or 'unset' as a gitattribute on that pathname.
20 OPTIONS
21 -------
22 -a, --all::
23         List all attributes that are associated with the specified
24         paths.  If this option is used, then 'unspecified' attributes
25         will not be included in the output.
27 --cached::
28         Consider `.gitattributes` in the index only, ignoring the working tree.
30 --stdin::
31         Read pathnames from the standard input, one per line,
32         instead of from the command line.
34 -z::
35         The output format is modified to be machine-parsable.
36         If `--stdin` is also given, input paths are separated
37         with a NUL character instead of a linefeed character.
39 --source=<tree-ish>::
40         Check attributes against the specified tree-ish. It is common to
41         specify the source tree by naming a commit, branch, or tag associated
42         with it.
44 \--::
45         Interpret all preceding arguments as attributes and all following
46         arguments as path names.
48 If none of `--stdin`, `--all`, or `--` is used, the first argument
49 will be treated as an attribute and the rest of the arguments as
50 pathnames.
52 OUTPUT
53 ------
55 The output is of the form:
56 <path> COLON SP <attribute> COLON SP <info> LF
58 unless `-z` is in effect, in which case NUL is used as delimiter:
59 <path> NUL <attribute> NUL <info> NUL
62 <path> is the path of a file being queried, <attribute> is an attribute
63 being queried, and <info> can be either:
65 'unspecified';; when the attribute is not defined for the path.
66 'unset';;       when the attribute is defined as false.
67 'set';;         when the attribute is defined as true.
68 <value>;;       when a value has been assigned to the attribute.
70 Buffering happens as documented under the `GIT_FLUSH` option in
71 linkgit:git[1].  The caller is responsible for avoiding deadlocks
72 caused by overfilling an input buffer or reading from an empty output
73 buffer.
75 EXAMPLES
76 --------
78 In the examples, the following '.gitattributes' file is used:
79 ---------------
80 *.java diff=java -crlf myAttr
81 NoMyAttr.java !myAttr
82 README caveat=unspecified
83 ---------------
85 * Listing a single attribute:
86 ---------------
87 $ git check-attr diff org/example/MyClass.java
88 org/example/MyClass.java: diff: java
89 ---------------
91 * Listing multiple attributes for a file:
92 ---------------
93 $ git check-attr crlf diff myAttr -- org/example/MyClass.java
94 org/example/MyClass.java: crlf: unset
95 org/example/MyClass.java: diff: java
96 org/example/MyClass.java: myAttr: set
97 ---------------
99 * Listing all attributes for a file:
100 ---------------
101 $ git check-attr --all -- org/example/MyClass.java
102 org/example/MyClass.java: diff: java
103 org/example/MyClass.java: myAttr: set
104 ---------------
106 * Listing an attribute for multiple files:
107 ---------------
108 $ git check-attr myAttr -- org/example/MyClass.java org/example/NoMyAttr.java
109 org/example/MyClass.java: myAttr: set
110 org/example/NoMyAttr.java: myAttr: unspecified
111 ---------------
113 * Not all values are equally unambiguous:
114 ---------------
115 $ git check-attr caveat README
116 README: caveat: unspecified
117 ---------------
119 SEE ALSO
120 --------
121 linkgit:gitattributes[5].
125 Part of the linkgit:git[1] suite