]> Lady’s Gitweb - Gitweb/blobdiff - gitweb.perl
gitweb: Always display link to blobdiff_plain in git_blobdiff
[Gitweb] / gitweb.perl
index 718bfb535b6401438cde267f4ff4eb1d8fcbc0497c4308e592da74cc5df45122..738fdda182aecef2efdd1d787528c7237f4b36165b34ed4511681a5833ebfce3 100755 (executable)
@@ -1706,8 +1706,30 @@ 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'};
+                       $file = $cgi->a({-href => href(action=>"blob", hash_base=>$hash_parent,
+                                                      hash=>$diffinfo->{'from_id'}, file_name=>$file),
+                                       -class => "list"}, esc_html($file));
+                       $patch_line =~ s|a/.*$|a/$file|g;
+                       print "<div class=\"diff from_file\">$patch_line</div>\n";
+
+                       $patch_line = <$fd>;
+                       chomp $patch_line;
+
+                       #$patch_line =~ m/^+++/;
+                       $file    = $diffinfo->{'to_file'};
+                       $file  ||= $diffinfo->{'file'};
+                       $file = $cgi->a({-href => href(action=>"blob", hash_base=>$hash,
+                                                      hash=>$diffinfo->{'to_id'}, file_name=>$file),
+                                       -class => "list"}, esc_html($file));
+                       $patch_line =~ s|b/.*|b/$file|g;
+                       print "<div class=\"diff to_file\">$patch_line</div>\n";
+
+                       next LINE;
                }
                next LINE if $in_header;
 
@@ -2768,18 +2790,18 @@ sub git_commit {
 sub git_blobdiff {
        mkdir($git_temp, 0700);
        git_header_html();
+       my $formats_nav =
+               $cgi->a({-href => href(action=>"blobdiff_plain",
+                                      hash=>$hash, hash_parent=>$hash_parent,
+                                      hash_base=>$hash_base, hash_parent_base=>$hash_parent_base,
+                                      file_name=>$file_name, file_parent=>$file_parent)},
+                       "plain");
        if (defined $hash_base && (my %co = parse_commit($hash_base))) {
-               my $formats_nav =
-                       $cgi->a({-href => href(action=>"blobdiff_plain",
-                                              hash=>$hash, hash_parent=>$hash_parent,
-                                              hash_base=>$hash_base, hash_parent_base=>$hash_parent_base,
-                                              file_name=>$file_name, file_parent=>$file_parent)},
-                               "plain");
                git_print_page_nav('','', $hash_base,$co{'tree'},$hash_base, $formats_nav);
                git_print_header_div('commit', esc_html($co{'title'}), $hash_base);
        } else {
                print <<HTML;
-<div class="page_nav"><br/><br/></div>
+<div class="page_nav"><br/>$formats_nav<br/></div>
 <div class="title">$hash vs $hash_parent</div>
 HTML
        }
This page took 0.17665 seconds and 4 git commands to generate.