@@ -138,6 +138,7 @@ sub setup_dir_diff
138
138
my %submodule ;
139
139
my %symlink ;
140
140
my @working_tree = ();
141
+ my %working_tree_dups = ();
141
142
my @rawdiff = split (' \0' , $diffrtn );
142
143
143
144
my $i = 0;
@@ -188,6 +189,10 @@ sub setup_dir_diff
188
189
}
189
190
190
191
if ($rmode ne $null_mode ) {
192
+ # Avoid duplicate working_tree entries
193
+ if ($working_tree_dups {$dst_path }++) {
194
+ next ;
195
+ }
191
196
my ($use , $wt_sha1 ) = use_wt_file($repo , $workdir ,
192
197
$dst_path , $rsha1 );
193
198
if ($use ) {
@@ -273,7 +278,7 @@ sub setup_dir_diff
273
278
# temporary file to both the left and right directories to show the
274
279
# change in the recorded SHA1 for the submodule.
275
280
for my $path (keys %submodule ) {
276
- my $ok ;
281
+ my $ok = 0 ;
277
282
if (defined ($submodule {$path }{left })) {
278
283
$ok = write_to_file(" $ldir /$path " ,
279
284
" Subproject commit $submodule {$path }{left}" );
@@ -289,7 +294,7 @@ sub setup_dir_diff
289
294
# shows only the link itself, not the contents of the link target.
290
295
# This loop replicates that behavior.
291
296
for my $path (keys %symlink ) {
292
- my $ok ;
297
+ my $ok = 0 ;
293
298
if (defined ($symlink {$path }{left })) {
294
299
$ok = write_to_file(" $ldir /$path " ,
295
300
$symlink {$path }{left });
0 commit comments