@matheusbsbs / matheus-bagliano / commits / bbb896d8e1
Fork 0

gitattributes: -crlf is not binary

The description of crlf attribute incorrectly said that "-crlf" means binary. It is true that for binary files you would want "-crlf", but that is not the same thing. We also have supported attribute macros and via that mechanism a handy "binary" to specify "-crlf -diff" at the same time. It was not documented anywhere as far as I can tell, even though the support was there from the very beginning. Signed-off-by: Junio C Hamano <gitster@pobox.com>

Junio C Hamano committed Aug 30, 2008 at 14:35 UTC bbb896d8e10f736bfda8f587c0009c358c9a8599
1 file changed +37 -3
Documentation/gitattributes.txt
+37 -3
@@ -105,9 +105,8 @@ Set::
105
106 Unset::
107
108 - Unsetting the `crlf` attribute on a path is meant to
109 - mark the path as a "binary" file. The path never goes
110 - through line endings conversion upon checkin/checkout.
108 + Unsetting the `crlf` attribute on a path tells git not to
109 + attempt any end-of-line conversion upon checkin or checkout.
110
111 Unspecified::
112
@@ -482,6 +481,41 @@ in the file. E.g. the string `$Format:%H$` will be replaced by the
481 commit hash.
482
483
484 +USING ATTRIBUTE MACROS
485 +----------------------
486 +
487 +You do not want any end-of-line conversions applied to, nor textual diffs
488 +produced for, any binary file you track. You would need to specify e.g.
489 +
490 +------------
491 +*.jpg -crlf -diff
492 +------------
493 +
494 +but that may become cumbersome, when you have many attributes. Using
495 +attribute macros, you can specify groups of attributes set or unset at
496 +the same time. The system knows a built-in attribute macro, `binary`:
497 +
498 +------------
499 +*.jpg binary
500 +------------
501 +
502 +which is equivalent to the above. Note that the attribute macros can only
503 +be "Set" (see the above example that sets "binary" macro as if it were an
504 +ordinary attribute --- setting it in turn unsets "crlf" and "diff").
505 +
506 +
507 +DEFINING ATTRIBUTE MACROS
508 +-------------------------
509 +
510 +Custom attribute macros can be defined only in the `.gitattributes` file
511 +at the toplevel (i.e. not in any subdirectory). The built-in attribute
512 +macro "binary" is equivalent to:
513 +
514 +------------
515 +[attr]binary -diff -crlf
516 +------------
517 +
518 +
519 EXAMPLE
520 -------
521