Re: Using clean/smudge filters with difftool

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Jun 19, 2015 at 10:57:55AM +0200, Michael J Gruber wrote:
> Junio C Hamano venit, vidit, dixit 19.06.2015 00:55:
> > John Keeping <john@xxxxxxxxxxxxx> writes:
> > 
> >> I think the summary is that there are some scenarios where the external
> >> diff tool should see the smudged version and others where the clean
> >> version is more appropriate and Git should support both options.  It
> >> seems this is a property of the filter, so I wonder if the best solution
> >> is a new "filter.<name>.extdiff = [clean|smudge]" configuration
> >> variable (there's probably a better name for the variable than
> >> "extdiff").
> > 
> > Not just the external diff, but the textconv filter obeys the same
> > rule.  The setting should be done the same way for both, if we are
> > going to go in that direction.
> > 
> 
> textconv is a "one-way" filter from "blob" to "readable blob". External
> diffs may prefer to work on "blob" rather than "readable blob", but the
> currect setup does not seem to produce surprises.
> 
> clean and smudge are two-way filters: clean from "worktree blob" (aka
> file) to "repo blob", smudge the other way round.
> 
> Typically, the user perceives these as inverse to each other. But we
> only require clean to be a left-inverse of smudge, i.e. "(cat-file then)
> smudge then clean" should give the same "repo blob" (as "cat-file").
> 
> We don't require that the other way round, i.e. we don't require smudge
> to be a left-inverse of clean, and in most setups (like the current one)
> it is not: smudge does not recreate what clean has cleaned out. It is a
> no-op (the "identity", while clean is a "projection").
> 
> Now, since external diff runs on smudged blobs, it appears as if we
> mixed cleaned and smudged blobs when feeding external diffs; whereas
> really, we mix "worktree blobs" and "smudged repo blobs", which is okay
> as per our definition of clean/smudge: the difference is irrelevant by
> definition.

I agree with this.

But I was wrong that "should diff clean"/"should diff smudged" is a
property of the filter.  I can also imagine a situation where a more
intelligent external diff tool wants to see the smudged version where a
naïve tool would want the clean version.

For example, some of the big file stores (e.g. git-lfs [1]) use
clean/smudge filters and I can imagine a diff utility that avoids
needing to fetch the data for large files and instead shows the diff on
the server when both blobs are available there.  In that case we
generally want to use the smudged copy for external diff, so the filter
would use that setting, but the diff utility knows better and would want
to override that.

[1] https://github.com/github/git-lfs
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]