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