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>
Jakub Narebski committed
Jan 7, 2007 at 02:52 UTC
62e4f26f3d55bd66989d9b953988de18ba393417
1 file changed
+5
-1
gitweb/gitweb.perl
+5
-1
@@ -2378,7 +2378,6 @@ sub git_patchset_body {
2378
my $patch_line;
2379
my $diffinfo;
2380
my (%from, %to);
2381
- my ($from_id, $to_id);
2381
2382
print "<div class=\"patchset\">\n";
2383
@@ -2392,6 +2391,7 @@ sub git_patchset_body {
2391
PATCH:
2392
while ($patch_line) {
2393
my @diff_header;
2394
+ my ($from_id, $to_id);
2395
2396
# git diff header
2397
#assert($patch_line =~ m/^diff /) if DEBUG;
@@ -2439,11 +2439,15 @@ sub git_patchset_body {
2439
$from{'href'} = href(action=>"blob", hash_base=>$hash_parent,
2440
hash=>$diffinfo->{'from_id'},
2441
file_name=>$from{'file'});
2442
+ } else {
2443
+ delete $from{'href'};
2444
}
2445
if ($diffinfo->{'status'} ne "D") { # not deleted file
2446
$to{'href'} = href(action=>"blob", hash_base=>$hash,
2447
hash=>$diffinfo->{'to_id'},
2448
file_name=>$to{'file'});
2449
+ } else {
2450
+ delete $to{'href'};
2451
}
2452
# this is first patch for raw difftree line with $patch_idx index
2453
# we index @$difftree array from 0, but number patches from 1