Subject: Re: [PATCH v2 2/3] t7800: fix tests when difftool uses --no-symlinks

From: John Keeping <[email-masked]>
Date: Sun, 24 Mar 2013 12:36:20 +0000

On Sat, Mar 23, 2013 at 10:19:36PM -0700, Junio C Hamano wrote:
> > In the longer term, difftool probably needs to learn to warn the user
> > instead of overwrite any changes that have been made to the working tree
> > file.
> 
> Questionable.
> 
> Admittedly I do not use difftool myself, and I have long assumed
> that difftool users are using the tools to _view_ the changes, but
> apparently some of the tools let the user muck with what is shown,
> and also apparently people seem to like the fact that they can make
> changes.  So I've led to believe the "update in difftool, take the
> change back to working tree, either by making symbolic links or
> copying them back" behaviour was a _feature_.

Yes it is.  I think my explanation wasn't clear enough here.

What currently happens is that after the user's tool has finished
running the working tree file and temporary file are compared and if
they are different then the temporary file is copied over the working
tree file.

This is good if the user has edited the temporary file, but what if they
edit they working tree file while using the tool to examine the
differences?  I think we need to at the very least look at the mtime of
the files and refuse to copy over the temporary file if that of the
working tree file is newer.

Obviously none of this matters if we can use symlinks, but in the
non-symlink case I think a user might find it surprising if the
(unmodified) file used by their diff tool were suddenly copied over the
working tree wiping out the changes they have just made.

> It is possible that this is not universally considerd as a feature,
> but if that is the case, I think the right way to do this is to tell
> the tools _not_ to let the user to modify contents they show in the
> first place, not letting the user modify and then warning after the
> fact.