Re: [PATCH] Document the textconv filter.
- From
Matthieu Moy <matthieu.moy@imag.fr>
- Date
- Sep 28, 2008, 12:29 UTC
- Message-ID
- <vpq7i8wzc5b.fsf@bauges.imag.fr>
- In-Reply-To
- <200809281307.21409.johannes.sixt@telecom.at>
Johannes Sixt <johannes.sixt@telecom.at> writes:
Show 15 quoted lines
> On Sonntag, 28. September 2008, Matthieu Moy wrote: >> +Converting files to text before a diff >> +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >> + >> +The attribute `textconv` affects 'git diff' in a way similar to the >> +`diff` attribute, but with `textconv`, the user provides only a way to >> +convert the file into text, and git takes care of doing the diff as >> +usual (i.e. other options of 'git diff' such as '--color' remain >> +available). >> + >> +The value of `textconv` must be a string, which is the textconv >> +driver. > > Wouldn't it be much more useful to have git parse stdout of the custom diff > tool in order to colorize it?
That would do it for --color, but not --color-words for example. The problem with the GIT_EXTERNAL_DIFF is that the diff tool has to re-implement everything that "git diff" already do.
Take my opendocument diff script :
http://www-verimag.imag.fr/~moy/opendocument/git-oodiff
That's 77 lines of code as a wrapper to odt2txt and diff. With the "textconv" attribute, it's one line in .gitattributes, and two in ~/.gitconfig.
Show 13 quoted lines
> Of course, this would mean that external diff tools are more > complicated and their stdout has to conform mostly to the git diff > syntax. But: > >> +To tell git to use the `exif` filter for jpeg images, use: >> + >> +---------------------------------------------------------------- >> +*.jpg textconv=exif >> +---------------------------------------------------------------- > > In this very example it would be possible that the external diff driver shows > the differences in the image in a window and also produces EXIF information > on stdout.
Yes, but that's really a specific example. Having git colorize the diff would be a little extra, but that wouldn't reduce the effort to write the external diff tool itself, and doesn't give you _all_ of git-diff, just --color.
-- Matthieu