diff options
author | Jeff King <peff@peff.net> | 2011-01-09 15:10:04 -0500 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2011-01-10 10:00:14 -0800 |
commit | ab4356111afb28568bf1ad2e909b6ecf9f83a5e6 (patch) | |
tree | a1e508cb76b349019bfe7221439b0b867f6fb681 | |
parent | cb198b3b67feb2c0a6f22199ec14fa48d18ac1ce (diff) | |
download | git-ab4356111afb28568bf1ad2e909b6ecf9f83a5e6.tar.gz |
docs: explain diff.*.binary option
This was added long ago as part of the userdiff refactoring
for textconv, as internally it made the code simpler and
cleaner. However, there was never a concrete use case for
actually using the config variable.
Now that Matthieu Moy has provided such a use case, it's
easy to explain it using his example.
Signed-off-by: Jeff King <peff@peff.net>
Acked-by: Matthieu Moy <Matthieu.Moy@grenoble-inp.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r-- | Documentation/gitattributes.txt | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt index d892e642ed..f3f880e270 100644 --- a/Documentation/gitattributes.txt +++ b/Documentation/gitattributes.txt @@ -415,6 +415,39 @@ should generate it separately and send it as a comment _in addition to_ the usual binary diff that you might send. +Marking files as binary +^^^^^^^^^^^^^^^^^^^^^^^ + +Git usually guesses correctly whether a blob contains text or binary +data by examining the beginning of the contents. However, sometimes you +may want to override its decision, either because a blob contains binary +data later in the file, or because the content, while technically +composed of text characters, is opaque to a human reader. For example, +many postscript files contain only ascii characters, but produce noisy +and meaningless diffs. + +The simplest way to mark a file as binary is to unset the diff +attribute in the `.gitattributes` file: + +------------------------ +*.ps -diff +------------------------ + +This will cause git to generate `Binary files differ` (or a binary +patch, if binary patches are enabled) instead of a regular diff. + +However, one may also want to specify other diff driver attributes. For +example, you might want to use `textconv` to convert postscript files to +an ascii representation for human viewing, but otherwise treat them as +binary files. You cannot specify both `-diff` and `diff=ps` attributes. +The solution is to use the `diff.*.binary` config option: + +------------------------ +[diff "ps"] + textconv = ps2ascii + binary = true +------------------------ + Performing a three-way merge ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |