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

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

 



On Sun, Mar 24, 2013 at 5:36 AM, John Keeping <john@xxxxxxxxxxxxx> wrote:
> 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.

Thanks, this adds a little more safety to the operation, which is good.
The downside is that it's a performance hit since we end up running
an additional hash-object on every worktree file.
I would definitely choose safety/correctness in this situation.

This makes me wonder whether the modifiable mode should be made
more explicit, either in the documentation or via a flag.

Imagine if --dir-diff also honored --edit and --no-edit flags.

Right now --edit is the default.  If we had foreseen these various
edge cases and unintended copy-backs then we may have initially
chosen --no-edit as the default, but that's not really my point.

What I'm thinking is that it might be good for the tool to
learn --edit/--no-edit so that the symlink/copy-back heuristic
can be documented alongside that option.  Users can then know
what to expect when using this mode.  --no-edit would also be
faster since it can avoid all these extra steps.

It could also learn "difftool.dirDiffEditable" to control the
default, which would eliminate the pain in needing to supply
the flag on every invocation.

What do you think about officially supporting a read-only mode?
-- 
David
--
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]