From: Junio C Hamano <gitster@pobox.com>
To: "Avery Pennarun" <apenwarr@gmail.com>
Cc: git@vger.kernel.org, arman@twinsun.com
Subject: Re: [PATCH] diff: treat -crlf files as binary
Date: Sat, 30 Aug 2008 14:34:55 -0700 [thread overview]
Message-ID: <7vljyefaps.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <32541b130808291456k3de953a2yd1e93bc27ad14293@mail.gmail.com> (Avery Pennarun's message of "Fri, 29 Aug 2008 17:56:38 -0400")
"Avery Pennarun" <apenwarr@gmail.com> writes:
> I think the bug is that "crlf=false" should not be considered the same
> as "binary=true", which seems to be a bug in the documentation, not
> the program.
Yeah, that's right. How about doing something like this?
Documentation/gitattributes.txt | 39 ++++++++++++++++++++++++++++++++++++---
1 files changed, 36 insertions(+), 3 deletions(-)
diff --git i/Documentation/gitattributes.txt w/Documentation/gitattributes.txt
index db16b0c..ec8a860 100644
--- i/Documentation/gitattributes.txt
+++ w/Documentation/gitattributes.txt
@@ -105,9 +105,8 @@ Set::
Unset::
- Unsetting the `crlf` attribute on a path is meant to
- mark the path as a "binary" file. The path never goes
- through line endings conversion upon checkin/checkout.
+ Unsetting the `crlf` attribute on a path is tells git
+ not to attempt any end-of-line conversion upon checkin/checkout.
Unspecified::
@@ -482,6 +481,40 @@ in the file. E.g. the string `$Format:%H$` will be replaced by the
commit hash.
+USING ATTRIBUTE MACROS
+----------------------
+
+You do not want any end-of-line conversions applied to, nor textual diffs
+produced for any binary file you track. You would need to specify e.g.
+
+------------
+*.jpg -crlf -diff
+------------
+
+but that is cumbersome. Using attribute macros, you can specify groups of
+attributes set or unset at the same time. The system knows a built-in
+attribute macro, `binary`:
+
+------------
+*.jpg binary
+------------
+
+which is equivalent to the above. Note that the attribute macros can only
+be "Set" (see the above example).
+
+
+DEFINING ATTRIBUTE MACROS
+-------------------------
+
+Custom attribute macros can be defined only in the `.gitattributes` file
+at the toplevel (i.e. not in any subdirectory). The built-in attribute
+macro "binary" is equivalent to:
+
+------------
+[attr]binary -diff -crlf
+------------
+
+
EXAMPLE
-------
next prev parent reply other threads:[~2008-08-30 21:36 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-29 21:28 [PATCH] diff: treat -crlf files as binary Junio C Hamano
2008-08-29 21:56 ` Avery Pennarun
2008-08-30 21:34 ` Junio C Hamano [this message]
2008-08-31 2:34 ` Avery Pennarun
2008-08-31 8:27 ` Matthieu Moy
2008-08-31 9:16 ` Alex Riesen
2008-08-31 16:25 ` Junio C Hamano
2008-08-31 18:34 ` Avery Pennarun
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7vljyefaps.fsf@gitster.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=apenwarr@gmail.com \
--cc=arman@twinsun.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).