summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2012-07-24 03:56:17 (GMT)
committerJunio C Hamano <gitster@pobox.com>2012-07-24 03:56:17 (GMT)
commitb18c74c92f53572896b6f98cf69fe08c65ae2455 (patch)
tree46f2149caf3e00637216405a717fd4bb364a277f
parenta122c42e6fb5e8bd3b42634be50c4d48b2cb6599 (diff)
parent05df532655e14ba351b4ee8a0acd8f190ed0b745 (diff)
downloadgit-b18c74c92f53572896b6f98cf69fe08c65ae2455.zip
git-b18c74c92f53572896b6f98cf69fe08c65ae2455.tar.gz
git-b18c74c92f53572896b6f98cf69fe08c65ae2455.tar.bz2
Merge branch 'th/difftool-diffall'
Finishing touches to difftool --dirdiff. * th/difftool-diffall: difftool: only copy back files modified during directory diff
-rwxr-xr-xgit-difftool.perl7
1 files changed, 5 insertions, 2 deletions
diff --git a/git-difftool.perl b/git-difftool.perl
index ae1e052..c079854 100755
--- a/git-difftool.perl
+++ b/git-difftool.perl
@@ -15,6 +15,7 @@ use strict;
use warnings;
use File::Basename qw(dirname);
use File::Copy;
+use File::Compare;
use File::Find;
use File::stat;
use File::Path qw(mkpath);
@@ -336,8 +337,10 @@ if (defined($dirdiff)) {
# files were modified during the diff, then the changes
# should be copied back to the working tree
for my $file (@working_tree) {
- copy("$b/$file", "$workdir/$file") or die $!;
- chmod(stat("$b/$file")->mode, "$workdir/$file") or die $!;
+ if (-e "$b/$file" && compare("$b/$file", "$workdir/$file")) {
+ copy("$b/$file", "$workdir/$file") or die $!;
+ chmod(stat("$b/$file")->mode, "$workdir/$file") or die $!;
+ }
}
} else {
if (defined($prompt)) {