blob: aa3b2bf2fcf764ca22f44bcfc081afd4e09328bb [file] [log] [blame]
Junio C Hamanoe90436a2007-04-22 07:22:131git-check-attr(1)
2=================
3
4NAME
5----
Junio C Hamano9bd39c42008-11-13 01:54:446git-check-attr - Display gitattributes information
Junio C Hamanoe90436a2007-04-22 07:22:137
8
9SYNOPSIS
10--------
Junio C Hamano7d06a8a2008-10-20 05:42:3311[verse]
Junio C Hamanof7279012011-08-18 06:13:1312'git check-attr' [-a | --all | attr...] [--] pathname...
Junio C Hamanodaf0aae2015-10-26 23:14:3013'git check-attr' --stdin [-z] [-a | --all | attr...]
Junio C Hamanoe90436a2007-04-22 07:22:1314
15DESCRIPTION
16-----------
Junio C Hamano1de75722009-03-26 08:39:3817For every pathname, this command will list if each attribute is 'unspecified',
Junio C Hamanoe90436a2007-04-22 07:22:1318'set', or 'unset' as a gitattribute on that pathname.
19
20OPTIONS
21-------
Junio C Hamanof7279012011-08-18 06:13:1322-a, --all::
23List all attributes that are associated with the specified
24paths. If this option is used, then 'unspecified' attributes
25will not be included in the output.
26
Junio C Hamano8fb66e52011-10-05 20:59:5127--cached::
28Consider `.gitattributes` in the index only, ignoring the working tree.
29
Junio C Hamano7d06a8a2008-10-20 05:42:3330--stdin::
Junio C Hamanodaf0aae2015-10-26 23:14:3031Read pathnames from the standard input, one per line,
32instead of from the command-line.
Junio C Hamano7d06a8a2008-10-20 05:42:3333
34-z::
Junio C Hamano535ed7a2013-09-04 20:35:5735The output format is modified to be machine-parseable.
36If `--stdin` is also given, input paths are separated
37with a NUL character instead of a linefeed character.
Junio C Hamano7d06a8a2008-10-20 05:42:3338
Junio C Hamanoe90436a2007-04-22 07:22:1339\--::
Junio C Hamano1de75722009-03-26 08:39:3840Interpret all preceding arguments as attributes and all following
Junio C Hamanof7279012011-08-18 06:13:1341arguments 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.
Junio C Hamanoe90436a2007-04-22 07:22:1346
Junio C Hamanocbb30862008-10-17 10:03:4247OUTPUT
48------
49
50The output is of the form:
51<path> COLON SP <attribute> COLON SP <info> LF
52
Junio C Hamano535ed7a2013-09-04 20:35:5753unless `-z` is in effect, in which case NUL is used as delimiter:
54<path> NUL <attribute> NUL <info> NUL
55
56
Junio C Hamano1de75722009-03-26 08:39:3857<path> is the path of a file being queried, <attribute> is an attribute
Junio C Hamanocbb30862008-10-17 10:03:4258being queried and <info> can be either:
59
60'unspecified';; when the attribute is not defined for the path.
Junio C Hamano1de75722009-03-26 08:39:3861'unset';; when the attribute is defined as false.
62'set';; when the attribute is defined as true.
Junio C Hamanocbb30862008-10-17 10:03:4263<value>;; when a value has been assigned to the attribute.
64
Junio C Hamanoc7102962013-05-29 23:57:1765Buffering 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
Junio C Hamanocbb30862008-10-17 10:03:4270EXAMPLES
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
Junio C Hamanof7279012011-08-18 06:13:1394* 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
Junio C Hamano1de75722009-03-26 08:39:38101* Listing an attribute for multiple files:
Junio C Hamanocbb30862008-10-17 10:03:42102---------------
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---------------
Junio C Hamanoe90436a2007-04-22 07:22:13113
Junio C Hamanof556fc22007-12-23 08:16:38114SEE ALSO
115--------
Junio C Hamano35738e82008-01-07 07:55:46116linkgit:gitattributes[5].
Junio C Hamanof556fc22007-12-23 08:16:38117
Junio C Hamanoe90436a2007-04-22 07:22:13118GIT
119---
Junio C Hamanof7c042d2008-06-06 22:50:53120Part of the linkgit:git[1] suite