difftool: avoid double slashes in symlink targets
authorJohn Keeping <john@keeping.me.uk>
Thu, 14 Mar 2013 20:19:40 +0000 (20:19 +0000)
committerJunio C Hamano <gitster@pobox.com>
Thu, 14 Mar 2013 21:29:05 +0000 (14:29 -0700)
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>
git-difftool.perl
index 0a90de414646b901e13abbf89aa78ae71e8b12f0..3cab257595a5f4dd50c474733a39f76bc897eb4e 100755 (executable)
@@ -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") {