Handle the case where compare() is unable to read its inputs. Emit a warning so that the user knows that something went wrong. We may later want to restructure the code so that we can inhibit tempdir cleanup when this condition is reached. Signed-off-by: David Aguilar <davvid@xxxxxxxxx> --- git-difftool.perl | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/git-difftool.perl b/git-difftool.perl index 3057480..591ee75 100755 --- a/git-difftool.perl +++ b/git-difftool.perl @@ -370,7 +370,16 @@ sub dir_diff # external tool did not replace the original link with a file. for my $file (@worktree) { next if $symlinks && -l "$b/$file"; - if (-f "$b/$file" && compare("$b/$file", "$workdir/$file")) { + next if ! -f "$b/$file"; + + my $diff = compare("$b/$file", "$workdir/$file"); + if ($diff == 0) { + next; + } elsif ($diff == -1 ) { + my $errmsg = "warning: could not compare "; + $errmsg += "'$b/$file' with '$workdir/$file'\n"; + warn $errmsg; + } elsif ($diff == 1) { copy("$b/$file", "$workdir/$file") or die $!; my $mode = stat("$b/$file")->mode; chmod($mode, "$workdir/$file") or die $!; -- 1.7.12.rc0.15.g8157c39 -- 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