test-sha1: add a binary output mode
[gitweb.git] / git-difftool.perl
index 67802922ccc41fa2993c1bce4ea1a3d2899c7a40..e57d3d1295a5ba0a9c02c19df512c909a0631baa 100755 (executable)
@@ -85,11 +85,13 @@ sub exit_cleanup
 
 sub use_wt_file
 {
-       my ($repo, $workdir, $file, $sha1, $symlinks) = @_;
+       my ($repo, $workdir, $file, $sha1) = @_;
        my $null_sha1 = '0' x 40;
 
-       if ($sha1 ne $null_sha1 and not $symlinks) {
-               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");
@@ -207,8 +209,7 @@ sub setup_dir_diff
 
                if ($rmode ne $null_mode) {
                        my ($use, $wt_sha1) = use_wt_file($repo, $workdir,
-                                                         $dst_path, $rsha1,
-                                                         $symlinks);
+                                                         $dst_path, $rsha1);
                        if ($use) {
                                push @working_tree, $dst_path;
                                $wtindex .= "$rmode $wt_sha1\t$dst_path\0";