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