summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2015-12-04 11:34:24 -0800
committerLibravatar Junio C Hamano <gitster@pobox.com>2015-12-04 11:34:24 -0800
commitaa0b4c31d9f21b806253ac16e59de82e2a5ec00e (patch)
treeba3f9fa7ade4c73e61ea6bc330c4c3bad68794b5
parentMerge branch 'dk/gc-idx-wo-pack' into maint (diff)
parentdifftool: ignore symbolic links in use_wt_file (diff)
downloadtgif-aa0b4c31d9f21b806253ac16e59de82e2a5ec00e.tar.xz
Merge branch 'da/difftool' into maint
The code to prepare the working tree side of temporary directory for the "dir-diff" feature forgot that symbolic links need not be copied (or symlinked) to the temporary area, as the code already special cases and overwrites them. Besides, it was wrong to try computing the object name of the target of symbolic link, which may not even exist or may be a directory. * da/difftool: difftool: ignore symbolic links in use_wt_file
-rwxr-xr-xgit-difftool.perl4
-rwxr-xr-xt/t7800-difftool.sh19
2 files changed, 20 insertions, 3 deletions
diff --git a/git-difftool.perl b/git-difftool.perl
index 7df7c8a9a7..488d14b153 100755
--- a/git-difftool.perl
+++ b/git-difftool.perl
@@ -70,9 +70,7 @@ sub use_wt_file
my ($repo, $workdir, $file, $sha1) = @_;
my $null_sha1 = '0' x 40;
- if (! -e "$workdir/$file") {
- # If the file doesn't exist in the working tree, we cannot
- # use it.
+ if (-l "$workdir/$file" || ! -e _) {
return (0, $null_sha1);
}
diff --git a/t/t7800-difftool.sh b/t/t7800-difftool.sh
index ea35a0241c..a771cf77f5 100755
--- a/t/t7800-difftool.sh
+++ b/t/t7800-difftool.sh
@@ -504,4 +504,23 @@ test_expect_success PERL 'difftool properly honors gitlink and core.worktree' '
)
'
+test_expect_success PERL,SYMLINKS 'difftool --dir-diff symlinked directories' '
+ git init dirlinks &&
+ (
+ cd dirlinks &&
+ git config diff.tool checktrees &&
+ git config difftool.checktrees.cmd "echo good" &&
+ mkdir foo &&
+ : >foo/bar &&
+ git add foo/bar &&
+ test_commit symlink-one &&
+ ln -s foo link &&
+ git add link &&
+ test_commit symlink-two &&
+ echo good >expect &&
+ git difftool --tool=checktrees --dir-diff HEAD~ >actual &&
+ test_cmp expect actual
+ )
+'
+
test_done