Skip to content

Commit

Permalink
difftool: avoid double slashes in symlink targets
Browse files Browse the repository at this point in the history
When we add tests for symlinks in "git difftool --dir-diff" it's easier
to check the target path if we don't have to worry about double slashes
separating directories.  Remove the trailing slash (if present) from
$workdir before creating the symlinks in order to avoid this.

Signed-off-by: John Keeping <john@keeping.me.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
John Keeping authored and Junio C Hamano committed Mar 14, 2013
1 parent 8aa10d4 commit e0976dc
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion git-difftool.perl
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,9 @@ sub setup_dir_diff
delete($ENV{GIT_INDEX_FILE});

# Changes in the working tree need special treatment since they are
# not part of the index
# not part of the index. Remove any trailing slash from $workdir
# before starting to avoid double slashes in symlink targets.
$workdir =~ s|/$||;
for my $file (@working_tree) {
my $dir = dirname($file);
unless (-d "$rdir/$dir") {
Expand Down

0 comments on commit e0976dc

Please sign in to comment.