Skip to content

Commit

Permalink
Merge branch 'th/difftool-diffall'
Browse files Browse the repository at this point in the history
Finishing touches to difftool --dirdiff.

* th/difftool-diffall:
  difftool: only copy back files modified during directory diff
  • Loading branch information
Junio C Hamano committed Jul 24, 2012
2 parents a122c42 + 05df532 commit b18c74c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions git-difftool.perl
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use warnings;
use File::Basename qw(dirname);
use File::Copy;
use File::Compare;
use File::Find;
use File::stat;
use File::Path qw(mkpath);
Expand Down Expand Up @@ -336,8 +337,10 @@ sub write_to_file
# 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)) {
Expand Down

0 comments on commit b18c74c

Please sign in to comment.