John Keeping <john@xxxxxxxxxxxxx> writes: > When 'git difftool --dir-diff' is using --no-symlinks (either explicitly > or implicitly because it's running on Windows), any working tree files > that have been copied to the temporary directory are copied back after > the difftool completes. > > Because an earlier test uses "git add .", the "output" file used by > tests is tracked by Git and the following sequence occurs during some > tests: > > 1) the shell opens "output" to redirect the difftool output > 2) difftool copies the empty "output" to the temporary directory > 3) difftool runs "ls" which writes to "output" > 4) difftool copies the empty "output" file back over the output of the > command > 5) the output files doesn't contain the expected output, causing the > test to fail > > Instead of adding all changes, explicitly add only the files that the > test is using, allowing later tests to write their result files into the > working tree. Good. > 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_. 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. > Signed-off-by: John Keeping <john@xxxxxxxxxxxxx> > > --- > Changes since v1: > - Fix the actual cause of the issue in the test instead of masking it by > moving the output file under .git/ > > t/t7800-difftool.sh | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/t/t7800-difftool.sh b/t/t7800-difftool.sh > index e694972..a0b8042 100755 > --- a/t/t7800-difftool.sh > +++ b/t/t7800-difftool.sh > @@ -314,7 +314,7 @@ test_expect_success PERL 'setup change in subdirectory' ' > git commit -m "added sub/sub" && > echo test >>file && > echo test >>sub/sub && > - git add . && > + git add file sub/sub && > git commit -m "modified both" > ' -- 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