Skip to content

Commit e0976dc

Browse files
johnkeepinggitster
authored andcommitted
difftool: avoid double slashes in symlink targets
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 8aa10d4 commit e0976dc

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

git-difftool.perl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,9 @@ sub setup_dir_diff
209209
delete($ENV{GIT_INDEX_FILE});
210210

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

0 commit comments

Comments
 (0)