]> Lady’s Gitweb - Gitweb/blobdiff - gitweb.perl
gitweb: Provide links to commitdiff to each parent in 'commitdiff' view
[Gitweb] / gitweb.perl
index 47dcc9c9abbb9280bb37960b12a69795e373ac20a868e9a9042b240cdf7b2a8f..22929671b8bc41e3cefd5b8acfa31c4cf34a8bb677738aafc44c66a2f03c5e2f 100755 (executable)
@@ -2402,6 +2402,26 @@ sub git_difftree_body {
        print "<table class=\"" .
              (@parents > 1 ? "combined " : "") .
              "diff_tree\">\n";
+
+       # header only for combined diff in 'commitdiff' view
+       my $has_header = @parents > 1 && $action eq 'commitdiff';
+       if ($has_header) {
+               # table header
+               print "<thead><tr>\n" .
+                      "<th></th><th></th>\n"; # filename, patchN link
+               for (my $i = 0; $i < @parents; $i++) {
+                       my $par = $parents[$i];
+                       print "<th>" .
+                             $cgi->a({-href => href(action=>"commitdiff",
+                                                    hash=>$hash, hash_parent=>$par),
+                                      -title => 'commitdiff to parent number ' .
+                                                 ($i+1) . ': ' . substr($par,0,7)},
+                                     $i+1) .
+                             "&nbsp;</th>\n";
+               }
+               print "</tr></thead>\n<tbody>\n";
+       }
+
        my $alternate = 1;
        my $patchno = 0;
        foreach my $line (@{$difftree}) {
@@ -2674,6 +2694,7 @@ sub git_difftree_body {
                } # we should not encounter Unmerged (U) or Unknown (X) status
                print "</tr>\n";
        }
+       print "</tbody>" if $has_header;
        print "</table>\n";
 }
 
This page took 0.221304 seconds and 4 git commands to generate.