| 1 | git-check-attr(1) |
| 2 | ================= |
| 3 | |
| 4 | NAME |
| 5 | ---- |
| 6 | git-check-attr - Display gitattributes information |
| 7 | |
| 8 | |
| 9 | SYNOPSIS |
| 10 | -------- |
| 11 | [verse] |
| 12 | 'git check-attr' [--source <tree-ish>] [-a | --all | <attr>...] [--] <pathname>... |
| 13 | 'git check-attr' --stdin [-z] [--source <tree-ish>] [-a | --all | <attr>...] |
| 14 | |
| 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. |
| 19 | |
| 20 | OPTIONS |
| 21 | ------- |
| 22 | -a:: |
| 23 | --all:: |
| 24 | List all attributes that are associated with the specified |
| 25 | paths. If this option is used, then 'unspecified' attributes |
| 26 | will not be included in the output. |
| 27 | |
| 28 | --cached:: |
| 29 | Consider `.gitattributes` in the index only, ignoring the working tree. |
| 30 | |
| 31 | --stdin:: |
| 32 | Read pathnames from the standard input, one per line, |
| 33 | instead of from the command line. |
| 34 | |
| 35 | -z:: |
| 36 | The output format is modified to be machine-parsable. |
| 37 | If `--stdin` is also given, input paths are separated |
| 38 | with a NUL character instead of a linefeed character. |
| 39 | |
| 40 | --source=<tree-ish>:: |
| 41 | Check attributes against the specified tree-ish. It is common to |
| 42 | specify the source tree by naming a commit, branch, or tag associated |
| 43 | with it. |
| 44 | |
| 45 | \--:: |
| 46 | Interpret all preceding arguments as attributes and all following |
| 47 | arguments as path names. |
| 48 | |
| 49 | If none of `--stdin`, `--all`, or `--` is used, the first argument |
| 50 | will be treated as an attribute and the rest of the arguments as |
| 51 | pathnames. |
| 52 | |
| 53 | OUTPUT |
| 54 | ------ |
| 55 | |
| 56 | The output is of the form: |
| 57 | <path> COLON SP <attribute> COLON SP <info> LF |
| 58 | |
| 59 | unless `-z` is in effect, in which case NUL is used as delimiter: |
| 60 | <path> NUL <attribute> NUL <info> NUL |
| 61 | |
| 62 | |
| 63 | <path> is the path of a file being queried, <attribute> is an attribute |
| 64 | being queried, and <info> can be either: |
| 65 | |
| 66 | 'unspecified';; when the attribute is not defined for the path. |
| 67 | 'unset';; when the attribute is defined as false. |
| 68 | 'set';; when the attribute is defined as true. |
| 69 | <value>;; when a value has been assigned to the attribute. |
| 70 | |
| 71 | Buffering happens as documented under the `GIT_FLUSH` option in |
| 72 | linkgit:git[1]. The caller is responsible for avoiding deadlocks |
| 73 | caused by overfilling an input buffer or reading from an empty output |
| 74 | buffer. |
| 75 | |
| 76 | EXAMPLES |
| 77 | -------- |
| 78 | |
| 79 | In the examples, the following '.gitattributes' file is used: |
| 80 | |
| 81 | --------------- |
| 82 | *.java diff=java -crlf myAttr |
| 83 | NoMyAttr.java !myAttr |
| 84 | README caveat=unspecified |
| 85 | --------------- |
| 86 | |
| 87 | * Listing a single attribute: |
| 88 | + |
| 89 | --------------- |
| 90 | $ git check-attr diff org/example/MyClass.java |
| 91 | org/example/MyClass.java: diff: java |
| 92 | --------------- |
| 93 | |
| 94 | * Listing multiple attributes for a file: |
| 95 | + |
| 96 | --------------- |
| 97 | $ git check-attr crlf diff myAttr -- org/example/MyClass.java |
| 98 | org/example/MyClass.java: crlf: unset |
| 99 | org/example/MyClass.java: diff: java |
| 100 | org/example/MyClass.java: myAttr: set |
| 101 | --------------- |
| 102 | |
| 103 | * Listing all attributes for a file: |
| 104 | + |
| 105 | --------------- |
| 106 | $ git check-attr --all -- org/example/MyClass.java |
| 107 | org/example/MyClass.java: diff: java |
| 108 | org/example/MyClass.java: myAttr: set |
| 109 | --------------- |
| 110 | |
| 111 | * Listing an attribute for multiple files: |
| 112 | + |
| 113 | --------------- |
| 114 | $ git check-attr myAttr -- org/example/MyClass.java org/example/NoMyAttr.java |
| 115 | org/example/MyClass.java: myAttr: set |
| 116 | org/example/NoMyAttr.java: myAttr: unspecified |
| 117 | --------------- |
| 118 | |
| 119 | * Not all values are equally unambiguous: |
| 120 | + |
| 121 | --------------- |
| 122 | $ git check-attr caveat README |
| 123 | README: caveat: unspecified |
| 124 | --------------- |
| 125 | |
| 126 | SEE ALSO |
| 127 | -------- |
| 128 | linkgit:gitattributes[5]. |
| 129 | |
| 130 | GIT |
| 131 | --- |
| 132 | Part of the linkgit:git[1] suite |