Volume XXII, number 279Tuesday, October 6, 2026Latest message 12 minutes ago

The Git List

News and archive of git@vger.kernel.org, since April 2005

Questions about --ext-diff

3 messages between Aug 21, 2026 and Aug 24, 2026, from Anselm Schüler, Jeff King, Junio C Hamano.

Plain Markdown or JSON for tools and agents.

Anselm SchülerAug 21, 2026, 11:13 UTC on lore

I’m unsure what the purpose of --ext-diff is. It seems to me that custom diff filters should just always be executed.

Is --ext-diff a security feature? It seems like it isn’t, since git-diff will happily execute the diff filter.

Maybe I don’t correctly understand what a diff filter is intended to be used for. What situation would you want a diff filter to be run by git-diff, but not by e.g. git-show?

~Anselm Schüler <mail@anselmschueler.com>
Jeff KingAug 24, 2026, 18:23 UTC in reply to Anselm Schüler on lore

Re: Questions about --ext-diff

On Fri, Aug 21, 2026 at 01:13:13PM +0200, Anselm Schüler wrote:
Show 9 quoted lines
> I’m unsure what the purpose of --ext-diff is. It seems to me that custom
> diff filters should just always be executed.
> 
> Is --ext-diff a security feature? It seems like it isn’t, since git-diff
> will happily execute the diff filter.
> 
> Maybe I don’t correctly understand what a diff filter is intended to be used
> for. What situation would you want a diff filter to be run by git-diff, but
> not by e.g. git-show?

The external diff is free to do whatever it likes; it doesn't even have to generate text output. It could open a gui window, for example. So it may be surprising if you run git-log and suddenly dozens of windows open as we walk through history.

For git-show, there's certainly an argument that it ought to use the same default as git-diff (since we are showing about one commit's worth of diffs in either case). I suspect nobody really though much about it, and as git-show is implemented as (roughly) "git log --no-walk" under the hood, it inherited the defaults to disallow external diffs.

For many cases, I think textconv is a better experience. It is less flexible (you must be able to transform the binary into something textual, which is then diffed). But because of that it fits more neatly into existing commands. I may be biased as the author of textconv, though. ;)

-Peff
Junio C HamanoAug 24, 2026, 20:25 UTC in reply to Jeff King on lore

Re: Questions about --ext-diff

Jeff King <peff@peff.net> writes:
Show 5 quoted lines
> For many cases, I think textconv is a better experience. It is less
> flexible (you must be able to transform the binary into something
> textual, which is then diffed). But because of that it fits more neatly
> into existing commands. I may be biased as the author of textconv,
> though. ;)

As the author of ext-diff, I very much agree. The daily maintenance of the drafts of "What's cooking" report is very much the only thing that I find a custom --ext-diff program very useful, but I suspect that even its use can probably be substituted with creative use of the textconv filter, diff hunk header patterns, and the -W option.

Back to recent threads