]> Lady’s Gitweb - Gitweb/blobdiff - gitweb.perl
gitweb: Add invisible hyperlink to from-file/to-file diff header
[Gitweb] / gitweb.perl
index 718bfb535b6401438cde267f4ff4eb1d8fcbc0497c4308e592da74cc5df45122..486fec736a7b5f3f444125467b14821dd0dcf7a435508d6fdcba7c84a5b46ea7 100755 (executable)
@@ -1706,8 +1706,30 @@ sub git_patchset_body {
 
 
                if ($in_header && $patch_line =~ m/^---/) {
 
 
                if ($in_header && $patch_line =~ m/^---/) {
-                       #print "</div>\n"
+                       #print "</div>\n"; # class="diff extended_header"
                        $in_header = 0;
                        $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;
 
                }
                next LINE if $in_header;
 
This page took 0.152373 seconds and 4 git commands to generate.