Skip to content

Commit

Permalink
Merge branch 'da/difftool' into maint
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Junio C Hamano committed Dec 4, 2015
2 parents b50ceab + cfe2d4b commit aa0b4c3
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
4 changes: 1 addition & 3 deletions git-difftool.perl
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
19 changes: 19 additions & 0 deletions t/t7800-difftool.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit aa0b4c3

Please sign in to comment.