Subject: Re: Using clean/smudge filters with difftool

From: Junio C Hamano <[email-masked]>
Date: Thu, 18 Jun 2015 13:00:36 -0700

John Keeping <[email-masked]> writes:

> I think this is a difference between git-diff's internal and external
> diff modes which is working correctly, although possibly not desirably
> in this case.  The internal diff always uses clean files (so it runs the
> working tree file through the "clean" filter before applying the diff
> algorithm) but the external diff uses the working tree file so it
> applies the "smudge" filter to any blobs that it needs to checkout.
>
> Commit 4e218f5 (Smudge the files fed to external diff and textconv,
> 2009-03-21) was the source of this behaviour.

The fundamental design to use smudged version when interacting with
external programs actually predates that particular commit, I think.

The caller of the function that was updated by that commit, i.e.
prepare_temp_file(), reuses what is checked out to the working tree
when we can (i.e. it hasn't been modified from what we think is
checked out) and when it is beneficial to do so (i.e. on a system
with FAST_WORKING_DIRECTORY defined), which means the temporary file
given by the prepare_temp_file() that is used by the external tools
(both --ext-diff program and textconv filter) are designed to be fed
and work on the smudged version of the file.  4e218f5 did not change
that fundamental design; it just made things more consistent between
the case where we do create a new temporary file out of blob and we
allow an unmodified checked out file to be reused.