difftool: handle unmerged files in dir-diff mode
When files are unmerged they can show up as both unmerged and modified in the output of `git diff --raw`. This causes difftool's dir-diff to create filesystem entries for the same path twice, which fails when it encounters a duplicate path. Ensure that each worktree path is only processed once. Add a test to demonstrate the breakage. Reported-by: Jan Smets <jan@smets.cx> Signed-off-by: David Aguilar <davvid@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
951b551d0f
commit
366f9cea18
@ -138,6 +138,7 @@ sub setup_dir_diff
|
||||
my %submodule;
|
||||
my %symlink;
|
||||
my @working_tree = ();
|
||||
my %working_tree_dups = ();
|
||||
my @rawdiff = split('\0', $diffrtn);
|
||||
|
||||
my $i = 0;
|
||||
@ -188,6 +189,10 @@ EOF
|
||||
}
|
||||
|
||||
if ($rmode ne $null_mode) {
|
||||
# Avoid duplicate working_tree entries
|
||||
if ($working_tree_dups{$dst_path}++) {
|
||||
next;
|
||||
}
|
||||
my ($use, $wt_sha1) = use_wt_file($repo, $workdir,
|
||||
$dst_path, $rsha1);
|
||||
if ($use) {
|
||||
|
||||
Reference in New Issue
Block a user