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