James Bowes | b568a50 | 2007-04-14 21:27:20 -0400 | [diff] [blame] | 1 | git-check-attr(1) |
| 2 | ================= |
| 3 | |
| 4 | NAME |
| 5 | ---- |
Matt Kraai | 0d641f7 | 2008-11-07 04:26:55 -0800 | [diff] [blame] | 6 | git-check-attr - Display gitattributes information |
James Bowes | b568a50 | 2007-04-14 21:27:20 -0400 | [diff] [blame] | 7 | |
| 8 | |
| 9 | SYNOPSIS |
| 10 | -------- |
Jonas Fonseca | e7108fc | 2008-10-15 09:11:52 +0200 | [diff] [blame] | 11 | [verse] |
Robert P. J. Day | de61305 | 2018-05-24 16:11:39 -0400 | [diff] [blame] | 12 | 'git check-attr' [-a | --all | <attr>...] [--] <pathname>... |
| 13 | 'git check-attr' --stdin [-z] [-a | --all | <attr>...] |
James Bowes | b568a50 | 2007-04-14 21:27:20 -0400 | [diff] [blame] | 14 | |
| 15 | DESCRIPTION |
| 16 | ----------- |
David J. Mellor | 3460a60 | 2009-03-22 18:00:16 -0700 | [diff] [blame] | 17 | For every pathname, this command will list if each attribute is 'unspecified', |
James Bowes | b568a50 | 2007-04-14 21:27:20 -0400 | [diff] [blame] | 18 | 'set', or 'unset' as a gitattribute on that pathname. |
| 19 | |
| 20 | OPTIONS |
| 21 | ------- |
Michael Haggerty | 4ca0f18 | 2011-08-04 06:36:30 +0200 | [diff] [blame] | 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. |
| 26 | |
Jay Soffian | b2b3e9c | 2011-09-22 17:44:20 -0400 | [diff] [blame] | 27 | --cached:: |
| 28 | Consider `.gitattributes` in the index only, ignoring the working tree. |
| 29 | |
Dmitry Potapov | b466685 | 2008-10-07 04:16:52 +0400 | [diff] [blame] | 30 | --stdin:: |
Junio C Hamano | 33e8fc8 | 2015-10-16 11:27:42 -0700 | [diff] [blame] | 31 | Read pathnames from the standard input, one per line, |
| 32 | instead of from the command-line. |
Dmitry Potapov | b466685 | 2008-10-07 04:16:52 +0400 | [diff] [blame] | 33 | |
| 34 | -z:: |
Elijah Newren | 031fd4b | 2019-11-05 17:07:20 +0000 | [diff] [blame] | 35 | The output format is modified to be machine-parsable. |
Junio C Hamano | f7cd8c5 | 2013-07-11 23:02:40 -0700 | [diff] [blame] | 36 | If `--stdin` is also given, input paths are separated |
| 37 | with a NUL character instead of a linefeed character. |
Dmitry Potapov | b466685 | 2008-10-07 04:16:52 +0400 | [diff] [blame] | 38 | |
James Bowes | b568a50 | 2007-04-14 21:27:20 -0400 | [diff] [blame] | 39 | \--:: |
David J. Mellor | 3460a60 | 2009-03-22 18:00:16 -0700 | [diff] [blame] | 40 | Interpret all preceding arguments as attributes and all following |
Michael Haggerty | ca64d06 | 2011-08-04 06:36:32 +0200 | [diff] [blame] | 41 | arguments as path names. |
| 42 | |
| 43 | If none of `--stdin`, `--all`, or `--` is used, the first argument |
| 44 | will be treated as an attribute and the rest of the arguments as |
| 45 | pathnames. |
James Bowes | b568a50 | 2007-04-14 21:27:20 -0400 | [diff] [blame] | 46 | |
Jonas Fonseca | 5782566 | 2008-10-15 09:10:58 +0200 | [diff] [blame] | 47 | OUTPUT |
| 48 | ------ |
| 49 | |
| 50 | The output is of the form: |
| 51 | <path> COLON SP <attribute> COLON SP <info> LF |
| 52 | |
Junio C Hamano | f7cd8c5 | 2013-07-11 23:02:40 -0700 | [diff] [blame] | 53 | unless `-z` is in effect, in which case NUL is used as delimiter: |
| 54 | <path> NUL <attribute> NUL <info> NUL |
| 55 | |
| 56 | |
David J. Mellor | 3460a60 | 2009-03-22 18:00:16 -0700 | [diff] [blame] | 57 | <path> is the path of a file being queried, <attribute> is an attribute |
Jonas Fonseca | 5782566 | 2008-10-15 09:10:58 +0200 | [diff] [blame] | 58 | being queried and <info> can be either: |
| 59 | |
| 60 | 'unspecified';; when the attribute is not defined for the path. |
David J. Mellor | 3460a60 | 2009-03-22 18:00:16 -0700 | [diff] [blame] | 61 | 'unset';; when the attribute is defined as false. |
| 62 | 'set';; when the attribute is defined as true. |
Jonas Fonseca | 5782566 | 2008-10-15 09:10:58 +0200 | [diff] [blame] | 63 | <value>;; when a value has been assigned to the attribute. |
| 64 | |
Adam Spiers | f1ed7fe | 2013-04-11 13:05:13 +0100 | [diff] [blame] | 65 | Buffering happens as documented under the `GIT_FLUSH` option in |
| 66 | linkgit:git[1]. The caller is responsible for avoiding deadlocks |
| 67 | caused by overfilling an input buffer or reading from an empty output |
| 68 | buffer. |
| 69 | |
Jonas Fonseca | 5782566 | 2008-10-15 09:10:58 +0200 | [diff] [blame] | 70 | EXAMPLES |
| 71 | -------- |
| 72 | |
| 73 | In the examples, the following '.gitattributes' file is used: |
| 74 | --------------- |
| 75 | *.java diff=java -crlf myAttr |
| 76 | NoMyAttr.java !myAttr |
| 77 | README caveat=unspecified |
| 78 | --------------- |
| 79 | |
| 80 | * Listing a single attribute: |
| 81 | --------------- |
| 82 | $ git check-attr diff org/example/MyClass.java |
| 83 | org/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 |
| 89 | org/example/MyClass.java: crlf: unset |
| 90 | org/example/MyClass.java: diff: java |
| 91 | org/example/MyClass.java: myAttr: set |
| 92 | --------------- |
| 93 | |
Michael Haggerty | 4ca0f18 | 2011-08-04 06:36:30 +0200 | [diff] [blame] | 94 | * Listing all attributes for a file: |
| 95 | --------------- |
| 96 | $ git check-attr --all -- org/example/MyClass.java |
| 97 | org/example/MyClass.java: diff: java |
| 98 | org/example/MyClass.java: myAttr: set |
| 99 | --------------- |
| 100 | |
David J. Mellor | 3460a60 | 2009-03-22 18:00:16 -0700 | [diff] [blame] | 101 | * Listing an attribute for multiple files: |
Jonas Fonseca | 5782566 | 2008-10-15 09:10:58 +0200 | [diff] [blame] | 102 | --------------- |
| 103 | $ git check-attr myAttr -- org/example/MyClass.java org/example/NoMyAttr.java |
| 104 | org/example/MyClass.java: myAttr: set |
| 105 | org/example/NoMyAttr.java: myAttr: unspecified |
| 106 | --------------- |
| 107 | |
| 108 | * Not all values are equally unambiguous: |
| 109 | --------------- |
| 110 | $ git check-attr caveat README |
| 111 | README: caveat: unspecified |
| 112 | --------------- |
James Bowes | b568a50 | 2007-04-14 21:27:20 -0400 | [diff] [blame] | 113 | |
Junio C Hamano | 0e545f7 | 2007-12-22 23:14:59 -0800 | [diff] [blame] | 114 | SEE ALSO |
| 115 | -------- |
Dan McGee | 5162e69 | 2007-12-29 00:20:38 -0600 | [diff] [blame] | 116 | linkgit:gitattributes[5]. |
Junio C Hamano | 0e545f7 | 2007-12-22 23:14:59 -0800 | [diff] [blame] | 117 | |
James Bowes | b568a50 | 2007-04-14 21:27:20 -0400 | [diff] [blame] | 118 | GIT |
| 119 | --- |
Christian Couder | 9e1f0a8 | 2008-06-06 09:07:32 +0200 | [diff] [blame] | 120 | Part of the linkgit:git[1] suite |