]> git.ipfire.org Git - thirdparty/git.git/blame - Documentation/git-check-attr.txt
t4034: abstract away SHA-1-specific constants
[thirdparty/git.git] / Documentation / git-check-attr.txt
CommitLineData
b568a503
JB
1git-check-attr(1)
2=================
3
4NAME
5----
0d641f75 6git-check-attr - Display gitattributes information
b568a503
JB
7
8
9SYNOPSIS
10--------
e7108fcb 11[verse]
de613050
RD
12'git check-attr' [-a | --all | <attr>...] [--] <pathname>...
13'git check-attr' --stdin [-z] [-a | --all | <attr>...]
b568a503
JB
14
15DESCRIPTION
16-----------
3460a600 17For every pathname, this command will list if each attribute is 'unspecified',
b568a503
JB
18'set', or 'unset' as a gitattribute on that pathname.
19
20OPTIONS
21-------
4ca0f188
MH
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.
26
b2b3e9c2
JS
27--cached::
28 Consider `.gitattributes` in the index only, ignoring the working tree.
29
b4666852 30--stdin::
33e8fc87
JH
31 Read pathnames from the standard input, one per line,
32 instead of from the command-line.
b4666852
DP
33
34-z::
f7cd8c50
JH
35 The output format is modified to be machine-parseable.
36 If `--stdin` is also given, input paths are separated
37 with a NUL character instead of a linefeed character.
b4666852 38
b568a503 39\--::
3460a600 40 Interpret all preceding arguments as attributes and all following
ca64d061
MH
41 arguments as path names.
42
43If none of `--stdin`, `--all`, or `--` is used, the first argument
44will be treated as an attribute and the rest of the arguments as
45pathnames.
b568a503 46
5782566d
JF
47OUTPUT
48------
49
50The output is of the form:
51<path> COLON SP <attribute> COLON SP <info> LF
52
f7cd8c50
JH
53unless `-z` is in effect, in which case NUL is used as delimiter:
54<path> NUL <attribute> NUL <info> NUL
55
56
3460a600 57<path> is the path of a file being queried, <attribute> is an attribute
5782566d
JF
58being queried and <info> can be either:
59
60'unspecified';; when the attribute is not defined for the path.
3460a600
DM
61'unset';; when the attribute is defined as false.
62'set';; when the attribute is defined as true.
5782566d
JF
63<value>;; when a value has been assigned to the attribute.
64
f1ed7fea
AS
65Buffering happens as documented under the `GIT_FLUSH` option in
66linkgit:git[1]. The caller is responsible for avoiding deadlocks
67caused by overfilling an input buffer or reading from an empty output
68buffer.
69
5782566d
JF
70EXAMPLES
71--------
72
73In the examples, the following '.gitattributes' file is used:
74---------------
75*.java diff=java -crlf myAttr
76NoMyAttr.java !myAttr
77README caveat=unspecified
78---------------
79
80* Listing a single attribute:
81---------------
82$ git check-attr diff org/example/MyClass.java
83org/example/MyClass.java: diff: java
84---------------
85
86* Listing multiple attributes for a file:
87---------------
88$ git check-attr crlf diff myAttr -- org/example/MyClass.java
89org/example/MyClass.java: crlf: unset
90org/example/MyClass.java: diff: java
91org/example/MyClass.java: myAttr: set
92---------------
93
4ca0f188
MH
94* Listing all attributes for a file:
95---------------
96$ git check-attr --all -- org/example/MyClass.java
97org/example/MyClass.java: diff: java
98org/example/MyClass.java: myAttr: set
99---------------
100
3460a600 101* Listing an attribute for multiple files:
5782566d
JF
102---------------
103$ git check-attr myAttr -- org/example/MyClass.java org/example/NoMyAttr.java
104org/example/MyClass.java: myAttr: set
105org/example/NoMyAttr.java: myAttr: unspecified
106---------------
107
108* Not all values are equally unambiguous:
109---------------
110$ git check-attr caveat README
111README: caveat: unspecified
112---------------
b568a503 113
0e545f75
JH
114SEE ALSO
115--------
5162e697 116linkgit:gitattributes[5].
0e545f75 117
b568a503
JB
118GIT
119---
9e1f0a85 120Part of the linkgit:git[1] suite