]> Lady’s Gitweb - Gitweb/blobdiff - gitweb.perl
gitweb: Parse two-line from-file/to-file diff header in git_patchset_body
[Gitweb] / gitweb.perl
index 718bfb535b6401438cde267f4ff4eb1d8fcbc0497c4308e592da74cc5df45122..89673a802fd7688110e1311673d64233c18ef78f6e7ee97181a430a1455bfe2d 100755 (executable)
@@ -1706,8 +1706,24 @@ sub git_patchset_body {
 
 
                if ($in_header && $patch_line =~ m/^---/) {
-                       #print "</div>\n"
+                       #print "</div>\n"; # class="diff extended_header"
                        $in_header = 0;
+
+                       my $file = $diffinfo->{'from_file'};
+                       $file  ||= $diffinfo->{'file'};
+                       $patch_line =~ s|a/[0-9a-fA-F]{40}|a/$file|g;
+                       print "<div class=\"diff from_file\">" . esc_html($patch_line) . "</div>\n";
+
+                       $patch_line = <$fd>;
+                       chomp $patch_line;
+
+                       #$patch_line =~ m/^+++/;
+                       $file    = $diffinfo->{'to_file'};
+                       $file  ||= $diffinfo->{'file'};
+                       $patch_line =~ s|b/[0-9a-fA-F]{40}|b/$file|g;
+                       print "<div class=\"diff to_file\">" . esc_html($patch_line) . "</div>\n";
+
+                       next LINE;
                }
                next LINE if $in_header;
 
This page took 0.211967 seconds and 4 git commands to generate.