aboutsummaryrefslogtreecommitdiff
path: root/userdiff.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2008-10-05 17:43:45 -0400
committerJunio C Hamano <gitster@pobox.com>2008-10-18 08:02:55 -0700
commit9cb92c390cefd3bf3f71bbda12eb04893c861361 (patch)
treeefa0051207b647a902bb9d7002e05410af303941 /userdiff.c
parent122aa6f9c000d0d286898e2eb7b3504ac6cb9ebd (diff)
downloadgit-9cb92c390cefd3bf3f71bbda12eb04893c861361.tar.gz
git-9cb92c390cefd3bf3f71bbda12eb04893c861361.tar.xz
diff: add filter for converting binary to text
When diffing binary files, it is sometimes nice to see the differences of a canonical text form rather than either a binary patch or simply "binary files differ." Until now, the only option for doing this was to define an external diff command to perform the diff. This was a lot of work, since the external command needed to take care of doing the diff itself (including mode changes), and lost the benefit of git's colorization and other options. This patch adds a text conversion option, which converts a file to its canonical format before performing the diff. This is less flexible than an arbitrary external diff, but is much less work to set up. For example: $ echo '*.jpg diff=exif' >>.gitattributes $ git config diff.exif.textconv exiftool $ git config diff.exif.binary false allows one to see jpg diffs represented by the text output of exiftool. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'userdiff.c')
-rw-r--r--userdiff.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/userdiff.c b/userdiff.c
index 58478a691..d95257ab3 100644
--- a/userdiff.c
+++ b/userdiff.c
@@ -140,6 +140,8 @@ int userdiff_config_porcelain(const char *k, const char *v)
if ((drv = parse_driver(k, v, "command")))
return parse_string(&drv->external, k, v);
+ if ((drv = parse_driver(k, v, "textconv")))
+ return parse_string(&drv->textconv, k, v);
return 0;
}