Git fork

Merge branch 'kk/gitweb-omit-expensive'

"gitweb" learned to optionally omit output of fields that are expensive
to generate.

By Kacper Kornet
* kk/gitweb-omit-expensive:
gitweb: Option to not display information about owner
gitweb: Option to omit column with time of the last change

+32 -10
+7
Documentation/gitweb.conf.txt
··· 499 499 Set `$maxload` to undefined value (`undef`) to turn this feature off. 500 500 The default value is 300. 501 501 502 + $omit_age_column:: 503 + If true, omit the column with date of the most current commit on the 504 + projects list page. It can save a bit of I/O and a fork per repository. 505 + 506 + $omit_owner:: 507 + If true prevents displaying information about repository owner. 508 + 502 509 $per_request_config:: 503 510 If this is set to code reference, it will be run once for each request. 504 511 You can set parts of configuration that change per session this way.
+25 -10
gitweb/gitweb.perl
··· 133 133 # (only effective if this variable evaluates to true) 134 134 our $export_ok = "++GITWEB_EXPORT_OK++"; 135 135 136 + # don't generate age column on the projects list page 137 + our $omit_age_column = 0; 138 + 139 + # don't generate information about owners of repositories 140 + our $omit_owner=0; 141 + 136 142 # show repository only if this subroutine returns true 137 143 # when given the path to the project, for example: 138 144 # sub { return -e "$_[0]/git-daemon-export-ok"; } ··· 5612 5618 ? esc_html_match_hl_chopped($pr->{'descr_long'}, 5613 5619 $pr->{'descr'}, $search_regexp) 5614 5620 : esc_html($pr->{'descr'})) . 5615 - "</td>\n" . 5616 - "<td><i>" . chop_and_escape_str($pr->{'owner'}, 15) . "</i></td>\n"; 5617 - print "<td class=\"". age_class($pr->{'age'}) . "\">" . 5618 - (defined $pr->{'age_string'} ? $pr->{'age_string'} : "No commits") . "</td>\n" . 5619 - "<td class=\"link\">" . 5621 + "</td>\n"; 5622 + unless ($omit_owner) { 5623 + print "<td><i>" . chop_and_escape_str($pr->{'owner'}, 15) . "</i></td>\n"; 5624 + } 5625 + unless ($omit_age_column) { 5626 + print "<td class=\"". age_class($pr->{'age'}) . "\">" . 5627 + (defined $pr->{'age_string'} ? $pr->{'age_string'} : "No commits") . "</td>\n"; 5628 + } 5629 + print"<td class=\"link\">" . 5620 5630 $cgi->a({-href => href(project=>$pr->{'path'}, action=>"summary")}, "summary") . " | " . 5621 5631 $cgi->a({-href => href(project=>$pr->{'path'}, action=>"shortlog")}, "shortlog") . " | " . 5622 5632 $cgi->a({-href => href(project=>$pr->{'path'}, action=>"log")}, "log") . " | " . ··· 5647 5657 'tagfilter' => $tagfilter) 5648 5658 if ($tagfilter || $search_regexp); 5649 5659 # fill the rest 5650 - @projects = fill_project_list_info(\@projects); 5660 + my @all_fields = ('descr', 'descr_long', 'ctags', 'category'); 5661 + push @all_fields, ('age', 'age_string') unless($omit_age_column); 5662 + push @all_fields, 'owner' unless($omit_owner); 5663 + @projects = fill_project_list_info(\@projects, @all_fields); 5651 5664 5652 5665 $order ||= $default_projects_order; 5653 5666 $from = 0 unless defined $from; ··· 5678 5691 } 5679 5692 print_sort_th('project', $order, 'Project'); 5680 5693 print_sort_th('descr', $order, 'Description'); 5681 - print_sort_th('owner', $order, 'Owner'); 5682 - print_sort_th('age', $order, 'Last Change'); 5694 + print_sort_th('owner', $order, 'Owner') unless $omit_owner; 5695 + print_sort_th('age', $order, 'Last Change') unless $omit_age_column; 5683 5696 print "<th></th>\n" . # for links 5684 5697 "</tr>\n"; 5685 5698 } ··· 6432 6445 6433 6446 print "<div class=\"title\">&nbsp;</div>\n"; 6434 6447 print "<table class=\"projects_list\">\n" . 6435 - "<tr id=\"metadata_desc\"><td>description</td><td>" . esc_html($descr) . "</td></tr>\n" . 6436 - "<tr id=\"metadata_owner\"><td>owner</td><td>" . esc_html($owner) . "</td></tr>\n"; 6448 + "<tr id=\"metadata_desc\"><td>description</td><td>" . esc_html($descr) . "</td></tr>\n"; 6449 + unless ($omit_owner) { 6450 + print "<tr id=\"metadata_owner\"><td>owner</td><td>" . esc_html($owner) . "</td></tr>\n"; 6451 + } 6437 6452 if (defined $cd{'rfc2822'}) { 6438 6453 print "<tr id=\"metadata_lchange\"><td>last change</td>" . 6439 6454 "<td>".format_timestamp_html(\%cd)."</td></tr>\n";