summaryrefslogtreecommitdiffstats
path: root/man1/git-check-attr.1
blob: 2614650356238ab8b0be4b6ab89e00a144412c68 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
'\" t
.\"     Title: git-check-attr
.\"    Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author]
.\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
.\"      Date: 2024-04-19
.\"    Manual: Git Manual
.\"    Source: Git 2.45.0.rc0
.\"  Language: English
.\"
.TH "GIT\-CHECK\-ATTR" "1" "2024\-04\-19" "Git 2\&.45\&.0\&.rc0" "Git Manual"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el       .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
git-check-attr \- Display gitattributes information
.SH "SYNOPSIS"
.sp
.nf
\fIgit check\-attr\fR [\-\-source <tree\-ish>] [\-a | \-\-all | <attr>\&...] [\-\-] <pathname>\&...
\fIgit check\-attr\fR \-\-stdin [\-z] [\-\-source <tree\-ish>] [\-a | \-\-all | <attr>\&...]
.fi
.sp
.SH "DESCRIPTION"
.sp
For every pathname, this command will list if each attribute is \fIunspecified\fR, \fIset\fR, or \fIunset\fR as a gitattribute on that pathname\&.
.SH "OPTIONS"
.PP
\-a, \-\-all
.RS 4
List all attributes that are associated with the specified paths\&. If this option is used, then
\fIunspecified\fR
attributes will not be included in the output\&.
.RE
.PP
\-\-cached
.RS 4
Consider
\fB\&.gitattributes\fR
in the index only, ignoring the working tree\&.
.RE
.PP
\-\-stdin
.RS 4
Read pathnames from the standard input, one per line, instead of from the command line\&.
.RE
.PP
\-z
.RS 4
The output format is modified to be machine\-parsable\&. If
\fB\-\-stdin\fR
is also given, input paths are separated with a NUL character instead of a linefeed character\&.
.RE
.PP
\-\-source=<tree\-ish>
.RS 4
Check attributes against the specified tree\-ish\&. It is common to specify the source tree by naming a commit, branch, or tag associated with it\&.
.RE
.PP
\-\-
.RS 4
Interpret all preceding arguments as attributes and all following arguments as path names\&.
.RE
.sp
If none of \fB\-\-stdin\fR, \fB\-\-all\fR, or \fB\-\-\fR is used, the first argument will be treated as an attribute and the rest of the arguments as pathnames\&.
.SH "OUTPUT"
.sp
The output is of the form: <path> COLON SP <attribute> COLON SP <info> LF
.sp
unless \fB\-z\fR is in effect, in which case NUL is used as delimiter: <path> NUL <attribute> NUL <info> NUL
.sp
<path> is the path of a file being queried, <attribute> is an attribute being queried, and <info> can be either:
.PP
\fIunspecified\fR
.RS 4
when the attribute is not defined for the path\&.
.RE
.PP
\fIunset\fR
.RS 4
when the attribute is defined as false\&.
.RE
.PP
\fIset\fR
.RS 4
when the attribute is defined as true\&.
.RE
.PP
<value>
.RS 4
when a value has been assigned to the attribute\&.
.RE
.sp
Buffering happens as documented under the \fBGIT_FLUSH\fR option in \fBgit\fR(1)\&. The caller is responsible for avoiding deadlocks caused by overfilling an input buffer or reading from an empty output buffer\&.
.SH "EXAMPLES"
.sp
In the examples, the following \fI\&.gitattributes\fR file is used:
.sp
.if n \{\
.RS 4
.\}
.nf
*\&.java diff=java \-crlf myAttr
NoMyAttr\&.java !myAttr
README caveat=unspecified
.fi
.if n \{\
.RE
.\}
.sp

.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Listing a single attribute:
.RE
.sp
.if n \{\
.RS 4
.\}
.nf
$ git check\-attr diff org/example/MyClass\&.java
org/example/MyClass\&.java: diff: java
.fi
.if n \{\
.RE
.\}
.sp

.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Listing multiple attributes for a file:
.RE
.sp
.if n \{\
.RS 4
.\}
.nf
$ git check\-attr crlf diff myAttr \-\- org/example/MyClass\&.java
org/example/MyClass\&.java: crlf: unset
org/example/MyClass\&.java: diff: java
org/example/MyClass\&.java: myAttr: set
.fi
.if n \{\
.RE
.\}
.sp

.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Listing all attributes for a file:
.RE
.sp
.if n \{\
.RS 4
.\}
.nf
$ git check\-attr \-\-all \-\- org/example/MyClass\&.java
org/example/MyClass\&.java: diff: java
org/example/MyClass\&.java: myAttr: set
.fi
.if n \{\
.RE
.\}
.sp

.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Listing an attribute for multiple files:
.RE
.sp
.if n \{\
.RS 4
.\}
.nf
$ git check\-attr myAttr \-\- org/example/MyClass\&.java org/example/NoMyAttr\&.java
org/example/MyClass\&.java: myAttr: set
org/example/NoMyAttr\&.java: myAttr: unspecified
.fi
.if n \{\
.RE
.\}
.sp

.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Not all values are equally unambiguous:
.RE
.sp
.if n \{\
.RS 4
.\}
.nf
$ git check\-attr caveat README
README: caveat: unspecified
.fi
.if n \{\
.RE
.\}
.sp
.SH "SEE ALSO"
.sp
\fBgitattributes\fR(5)\&.
.SH "GIT"
.sp
Part of the \fBgit\fR(1) suite