gitattributes: document how external diff drivers relate to diff features
The "Defining an external diff driver" section explains how to configure diff.<driver>.command but not how the driver relates to the rest of Git's diff machinery. In particular, the command only replaces the textual patch: word diff, function context, color, and the like cannot apply to its output, while the summary formats, blame, and git log -L do not run it at all and keep using the builtin diff. Spell this out so the scope of an external diff driver is clear. Signed-off-by: Michael Montalbo <mmontalbo@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Michael Montalbo committed
Aug 1, 2026 at 10:41 UTC
240662ef2da8f5609a5c07068e3c2016d830e3b4
1 file changed
+11
Documentation/gitattributes.adoc
+11
@@ -784,6 +784,17 @@ with the above configuration, i.e. `j-c-diff`, with 7
784
parameters, just like `GIT_EXTERNAL_DIFF` program is called.
785
See linkgit:git[1] for details.
786
787
+An external diff driver replaces the patch Git would otherwise
788
+produce for the path: Git runs the command and shows its output in
789
+place of its own. Output features that post-process Git's diff do
790
+not apply to the driver's output; word diff, function context (`-W`),
791
+`--color-moved`, and coloring all act on Git's builtin diff, not the
792
+driver's output.
793
+The driver is consulted only when Git generates a textual patch. The
794
+summary formats (`--stat`, `--numstat`, `--shortstat`, and
795
+`--dirstat`), `git blame`, and `git log -L` do not run it and
796
+continue to use Git's builtin diff.
797
+
798
If the program is able to ignore certain changes (similar to
799
`git diff --ignore-space-change`), then also set the option
800
`trustExitCode` to true. It is then expected to return exit code 1 if