Skip to content

Commit 62e4f26

Browse files
jnarebJunio C Hamano
authored andcommitted
gitweb: Fix error in git_patchest_body for file creation/deletion patch
$from_id, $to_id variables should be local per PATCH. Fix error in git_patchset_body for file creation (deletion) patches, where instead of /dev/null as from-file (to-file) diff header line, it had link to previous file with current file name. This error occured only if there was another patch before file creation (deletion) patch. Signed-off-by: Jakub Narebski <jnareb@gmail.com> Signed-off-by: Junio C Hamano <junkio@cox.net>
1 parent fffe694 commit 62e4f26

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

gitweb/gitweb.perl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2378,7 +2378,6 @@ sub git_patchset_body {
23782378
my $patch_line;
23792379
my $diffinfo;
23802380
my (%from, %to);
2381-
my ($from_id, $to_id);
23822381

23832382
print "<div class=\"patchset\">\n";
23842383

@@ -2392,6 +2391,7 @@ sub git_patchset_body {
23922391
PATCH:
23932392
while ($patch_line) {
23942393
my @diff_header;
2394+
my ($from_id, $to_id);
23952395

23962396
# git diff header
23972397
#assert($patch_line =~ m/^diff /) if DEBUG;
@@ -2439,11 +2439,15 @@ sub git_patchset_body {
24392439
$from{'href'} = href(action=>"blob", hash_base=>$hash_parent,
24402440
hash=>$diffinfo->{'from_id'},
24412441
file_name=>$from{'file'});
2442+
} else {
2443+
delete $from{'href'};
24422444
}
24432445
if ($diffinfo->{'status'} ne "D") { # not deleted file
24442446
$to{'href'} = href(action=>"blob", hash_base=>$hash,
24452447
hash=>$diffinfo->{'to_id'},
24462448
file_name=>$to{'file'});
2449+
} else {
2450+
delete $to{'href'};
24472451
}
24482452
# this is first patch for raw difftree line with $patch_idx index
24492453
# we index @$difftree array from 0, but number patches from 1

0 commit comments

Comments
 (0)