Skip to content

Commit 55375e9

Browse files
committed
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
2 parents 070d527 + 0ebe782 commit 55375e9

File tree

2 files changed

+32
-10
lines changed

2 files changed

+32
-10
lines changed

Documentation/gitweb.conf.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,13 @@ $maxload::
499499
Set `$maxload` to undefined value (`undef`) to turn this feature off.
500500
The default value is 300.
501501

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+
502509
$per_request_config::
503510
If this is set to code reference, it will be run once for each request.
504511
You can set parts of configuration that change per session this way.

gitweb/gitweb.perl

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,12 @@ sub evaluate_uri {
133133
# (only effective if this variable evaluates to true)
134134
our $export_ok = "++GITWEB_EXPORT_OK++";
135135

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+
136142
# show repository only if this subroutine returns true
137143
# when given the path to the project, for example:
138144
# sub { return -e "$_[0]/git-daemon-export-ok"; }
@@ -5612,11 +5618,15 @@ sub git_project_list_rows {
56125618
? esc_html_match_hl_chopped($pr->{'descr_long'},
56135619
$pr->{'descr'}, $search_regexp)
56145620
: 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\">" .
56205630
$cgi->a({-href => href(project=>$pr->{'path'}, action=>"summary")}, "summary") . " | " .
56215631
$cgi->a({-href => href(project=>$pr->{'path'}, action=>"shortlog")}, "shortlog") . " | " .
56225632
$cgi->a({-href => href(project=>$pr->{'path'}, action=>"log")}, "log") . " | " .
@@ -5647,7 +5657,10 @@ sub git_project_list_body {
56475657
'tagfilter' => $tagfilter)
56485658
if ($tagfilter || $search_regexp);
56495659
# 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);
56515664

56525665
$order ||= $default_projects_order;
56535666
$from = 0 unless defined $from;
@@ -5678,8 +5691,8 @@ sub git_project_list_body {
56785691
}
56795692
print_sort_th('project', $order, 'Project');
56805693
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;
56835696
print "<th></th>\n" . # for links
56845697
"</tr>\n";
56855698
}
@@ -6432,8 +6445,10 @@ sub git_summary {
64326445

64336446
print "<div class=\"title\">&nbsp;</div>\n";
64346447
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+
}
64376452
if (defined $cd{'rfc2822'}) {
64386453
print "<tr id=\"metadata_lchange\"><td>last change</td>" .
64396454
"<td>".format_timestamp_html(\%cd)."</td></tr>\n";

0 commit comments

Comments
 (0)