Merge branch 'rh/prompt-pcmode-avoid-eval-on-refname'
[git.git] / Documentation / git-check-attr.txt
blob00e2aa2df259d449602f59cbec33599346ebd8a0
1 git-check-attr(1)
2 =================
4 NAME
5 ----
6 git-check-attr - Display gitattributes information
9 SYNOPSIS
10 --------
11 [verse]
12 'git check-attr' [-a | --all | attr...] [--] pathname...
13 'git check-attr' --stdin [-z] [-a | --all | attr...] < <list-of-paths>
15 DESCRIPTION
16 -----------
17 For every pathname, this command will list if each attribute is 'unspecified',
18 'set', or 'unset' as a gitattribute on that pathname.
20 OPTIONS
21 -------
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.
27 --cached::
28         Consider `.gitattributes` in the index only, ignoring the working tree.
30 --stdin::
31         Read file names from stdin instead of from the command-line.
33 -z::
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.
38 \--::
39         Interpret all preceding arguments as attributes and all following
40         arguments as path names.
42 If none of `--stdin`, `--all`, or `--` is used, the first argument
43 will be treated as an attribute and the rest of the arguments as
44 pathnames.
46 OUTPUT
47 ------
49 The output is of the form:
50 <path> COLON SP <attribute> COLON SP <info> LF
52 unless `-z` is in effect, in which case NUL is used as delimiter:
53 <path> NUL <attribute> NUL <info> NUL
56 <path> is the path of a file being queried, <attribute> is an attribute
57 being queried and <info> can be either:
59 'unspecified';; when the attribute is not defined for the path.
60 'unset';;       when the attribute is defined as false.
61 'set';;         when the attribute is defined as true.
62 <value>;;       when a value has been assigned to the attribute.
64 Buffering happens as documented under the `GIT_FLUSH` option in
65 linkgit:git[1].  The caller is responsible for avoiding deadlocks
66 caused by overfilling an input buffer or reading from an empty output
67 buffer.
69 EXAMPLES
70 --------
72 In the examples, the following '.gitattributes' file is used:
73 ---------------
74 *.java diff=java -crlf myAttr
75 NoMyAttr.java !myAttr
76 README caveat=unspecified
77 ---------------
79 * Listing a single attribute:
80 ---------------
81 $ git check-attr diff org/example/MyClass.java
82 org/example/MyClass.java: diff: java
83 ---------------
85 * Listing multiple attributes for a file:
86 ---------------
87 $ git check-attr crlf diff myAttr -- org/example/MyClass.java
88 org/example/MyClass.java: crlf: unset
89 org/example/MyClass.java: diff: java
90 org/example/MyClass.java: myAttr: set
91 ---------------
93 * Listing all attributes for a file:
94 ---------------
95 $ git check-attr --all -- org/example/MyClass.java
96 org/example/MyClass.java: diff: java
97 org/example/MyClass.java: myAttr: set
98 ---------------
100 * Listing an attribute for multiple files:
101 ---------------
102 $ git check-attr myAttr -- org/example/MyClass.java org/example/NoMyAttr.java
103 org/example/MyClass.java: myAttr: set
104 org/example/NoMyAttr.java: myAttr: unspecified
105 ---------------
107 * Not all values are equally unambiguous:
108 ---------------
109 $ git check-attr caveat README
110 README: caveat: unspecified
111 ---------------
113 SEE ALSO
114 --------
115 linkgit:gitattributes[5].
119 Part of the linkgit:git[1] suite