blob: 84f41a8e82590f54bca103a067a95348093844b5 [file] [log] [blame]
James Bowesb568a502007-04-14 21:27:20 -04001git-check-attr(1)
2=================
3
4NAME
5----
Matt Kraai0d641f72008-11-07 04:26:55 -08006git-check-attr - Display gitattributes information
James Bowesb568a502007-04-14 21:27:20 -04007
8
9SYNOPSIS
10--------
Jonas Fonsecae7108fc2008-10-15 09:11:52 +020011[verse]
Robert P. J. Dayde613052018-05-24 16:11:39 -040012'git check-attr' [-a | --all | <attr>...] [--] <pathname>...
13'git check-attr' --stdin [-z] [-a | --all | <attr>...]
James Bowesb568a502007-04-14 21:27:20 -040014
15DESCRIPTION
16-----------
David J. Mellor3460a602009-03-22 18:00:16 -070017For every pathname, this command will list if each attribute is 'unspecified',
James Bowesb568a502007-04-14 21:27:20 -040018'set', or 'unset' as a gitattribute on that pathname.
19
20OPTIONS
21-------
Michael Haggerty4ca0f182011-08-04 06:36:30 +020022-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
Jay Soffianb2b3e9c2011-09-22 17:44:20 -040027--cached::
28 Consider `.gitattributes` in the index only, ignoring the working tree.
29
Dmitry Potapovb4666852008-10-07 04:16:52 +040030--stdin::
Junio C Hamano33e8fc82015-10-16 11:27:42 -070031 Read pathnames from the standard input, one per line,
32 instead of from the command-line.
Dmitry Potapovb4666852008-10-07 04:16:52 +040033
34-z::
Elijah Newren031fd4b2019-11-05 17:07:20 +000035 The output format is modified to be machine-parsable.
Junio C Hamanof7cd8c52013-07-11 23:02:40 -070036 If `--stdin` is also given, input paths are separated
37 with a NUL character instead of a linefeed character.
Dmitry Potapovb4666852008-10-07 04:16:52 +040038
James Bowesb568a502007-04-14 21:27:20 -040039\--::
David J. Mellor3460a602009-03-22 18:00:16 -070040 Interpret all preceding arguments as attributes and all following
Michael Haggertyca64d062011-08-04 06:36:32 +020041 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.
James Bowesb568a502007-04-14 21:27:20 -040046
Jonas Fonseca57825662008-10-15 09:10:58 +020047OUTPUT
48------
49
50The output is of the form:
51<path> COLON SP <attribute> COLON SP <info> LF
52
Junio C Hamanof7cd8c52013-07-11 23:02:40 -070053unless `-z` is in effect, in which case NUL is used as delimiter:
54<path> NUL <attribute> NUL <info> NUL
55
56
David J. Mellor3460a602009-03-22 18:00:16 -070057<path> is the path of a file being queried, <attribute> is an attribute
Jonas Fonseca57825662008-10-15 09:10:58 +020058being queried and <info> can be either:
59
60'unspecified';; when the attribute is not defined for the path.
David J. Mellor3460a602009-03-22 18:00:16 -070061'unset';; when the attribute is defined as false.
62'set';; when the attribute is defined as true.
Jonas Fonseca57825662008-10-15 09:10:58 +020063<value>;; when a value has been assigned to the attribute.
64
Adam Spiersf1ed7fe2013-04-11 13:05:13 +010065Buffering 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
Jonas Fonseca57825662008-10-15 09:10:58 +020070EXAMPLES
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
Michael Haggerty4ca0f182011-08-04 06:36:30 +020094* 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
David J. Mellor3460a602009-03-22 18:00:16 -0700101* Listing an attribute for multiple files:
Jonas Fonseca57825662008-10-15 09:10:58 +0200102---------------
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---------------
James Bowesb568a502007-04-14 21:27:20 -0400113
Junio C Hamano0e545f72007-12-22 23:14:59 -0800114SEE ALSO
115--------
Dan McGee5162e692007-12-29 00:20:38 -0600116linkgit:gitattributes[5].
Junio C Hamano0e545f72007-12-22 23:14:59 -0800117
James Bowesb568a502007-04-14 21:27:20 -0400118GIT
119---
Christian Couder9e1f0a82008-06-06 09:07:32 +0200120Part of the linkgit:git[1] suite