t1006: modernize output comparisons
[gitweb.git] / git-difftool.perl
index 67802922ccc41fa2993c1bce4ea1a3d2899c7a40..8a7520553776ec9d0c8d38526041dd37742d3bc1 100755 (executable)
@@ -92,6 +92,12 @@ sub use_wt_file
                return 0;
        }
 
+       if (! -e "$workdir/$file") {
+               # If the file doesn't exist in the working tree, we cannot
+               # use it.
+               return (0, $null_sha1);
+       }
+
        my $wt_sha1 = $repo->command_oneline('hash-object', "$workdir/$file");
        my $use = ($sha1 eq $null_sha1) || ($sha1 eq $wt_sha1);
        return ($use, $wt_sha1);