git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] doc: discuss textconv versus external diff drivers

From
Jeff King <peff@peff.net>
Date
May 24, 2011, 19:45 UTC
Message-ID
<20110524194527.GD584@sigill.intra.peff.net>
In-Reply-To
<1306196874-64687-1-git-send-email-jaysoffian@gmail.com>

We already talk about how to use each one and how they work, but it is a reasonable question to wonder why one might use one over the other.

Signed-off-by: Jeff King <peff@peff.net>
---
This can probably go with Jay's --textconv documentation topic.
 Documentation/gitattributes.txt |   31 +++++++++++++++++++++++++++++++
 1 files changed, 31 insertions(+), 0 deletions(-)
diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt
index 15aebc6..412c55b 100644
--- a/Documentation/gitattributes.txt
+++ b/Documentation/gitattributes.txt
@@ -593,6 +593,37 @@ and now produces better output), you can remove the cache
 manually with `git update-ref -d refs/notes/textconv/jpg` (where
 "jpg" is the name of the diff driver, as in the example above).
 
+Choosing textconv versus external diff
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+If you want to show differences between binary or specially-formatted
+blobs in your repository, you can choose to use either an external diff
+command, or to use textconv to convert them to a diff-able text format.
+Which method you choose depends on your exact situation.
+
+The advantage of using an external diff command is flexibility. You are
+not bound to find line-oriented changes, nor is it necessary for the
+output to resemble unified diff. You are free to locate and report
+changes in the most appropriate way for your data format.
+
+A textconv, by comparison, is much more limiting. You provide a
+transformation of the data into a line-oriented text format, and git
+uses its regular diff tools to generate the output. There are several
+advantages to choosing this method:
+
+1. Ease of use. It is often much simpler to write a binary to text
+   transformation than it is to perform your own diff. In many cases,
+   existing programs can be used as textconv filters (e.g., exif,
+   odt2txt).
+
+2. Git diff features. By performing only the transformation step
+   yourself, you can still utilize many of git's diff features,
+   including colorization, word-diff, and combined diffs for merges.
+
+3. Caching. Textconv caching can speed up repeated diffs, such as those
+   you might trigger by running `git log -p`.
+
+
 Marking files as binary
 ^^^^^^^^^^^^^^^^^^^^^^^
 
-- 
1.7.4.5.7.g2e01
Previous: Jeff King
Message 4 of 4 in “diff-options.txt: document --[no]-textconv”
  1. diff-options.txt: document --[no]-textconvJay Soffian, May 24, 2011
  2. Junio C HamanoMay 24, 2011
  3. Jeff KingMay 24, 2011
  4. doc: discuss textconv versus external diff driversJeff King, May 24, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.