gitweb: Option to omit column with time of the last change
Generating information about last change for a large number of git repositories can be very time consuming. This commit add an option to omit 'Last Change' column when presenting the list of repositories. Signed-off-by: Kacper Kornet <draenog@pld-linux.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Kacper Kornet committed
Apr 24, 2012 at 19:39 UTC
5710be46d88ea548159e7493973b5488e6d2799f
2 files changed
+15
-5
Documentation/gitweb.conf.txt
+4
@@ -499,6 +499,10 @@ $maxload::
499
Set `$maxload` to undefined value (`undef`) to turn this feature off.
500
The default value is 300.
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
$per_request_config::
507
If this is set to code reference, it will be run once for each request.
508
You can set parts of configuration that change per session this way.
gitweb/gitweb.perl
+11
-5
@@ -133,6 +133,9 @@ our $default_projects_order = "project";
133
# (only effective if this variable evaluates to true)
134
our $export_ok = "++GITWEB_EXPORT_OK++";
135
136
+# don't generate age column on the projects list page
137
+our $omit_age_column = 0;
138
+
139
# show repository only if this subroutine returns true
140
# when given the path to the project, for example:
141
# sub { return -e "$_[0]/git-daemon-export-ok"; }
@@ -5464,9 +5467,11 @@ sub git_project_list_rows {
5467
: esc_html($pr->{'descr'})) .
5468
"</td>\n" .
5469
"<td><i>" . chop_and_escape_str($pr->{'owner'}, 15) . "</i></td>\n";
5467
- print "<td class=\"". age_class($pr->{'age'}) . "\">" .
5468
- (defined $pr->{'age_string'} ? $pr->{'age_string'} : "No commits") . "</td>\n" .
5469
- "<td class=\"link\">" .
5470
+ unless ($omit_age_column) {
5471
+ print "<td class=\"". age_class($pr->{'age'}) . "\">" .
5472
+ (defined $pr->{'age_string'} ? $pr->{'age_string'} : "No commits") . "</td>\n";
5473
+ }
5474
+ print"<td class=\"link\">" .
5475
$cgi->a({-href => href(project=>$pr->{'path'}, action=>"summary")}, "summary") . " | " .
5476
$cgi->a({-href => href(project=>$pr->{'path'}, action=>"shortlog")}, "shortlog") . " | " .
5477
$cgi->a({-href => href(project=>$pr->{'path'}, action=>"log")}, "log") . " | " .
@@ -5497,7 +5502,8 @@ sub git_project_list_body {
5502
'tagfilter' => $tagfilter)
5503
if ($tagfilter || $search_regexp);
5504
# fill the rest
5500
- @projects = fill_project_list_info(\@projects);
5505
+ my @all_fields = $omit_age_column ? ('descr', 'descr_long', 'owner', 'ctags', 'category') : ();
5506
+ @projects = fill_project_list_info(\@projects, @all_fields);
5507
5508
$order ||= $default_projects_order;
5509
$from = 0 unless defined $from;
@@ -5529,7 +5535,7 @@ sub git_project_list_body {
5535
print_sort_th('project', $order, 'Project');
5536
print_sort_th('descr', $order, 'Description');
5537
print_sort_th('owner', $order, 'Owner');
5532
- print_sort_th('age', $order, 'Last Change');
5538
+ print_sort_th('age', $order, 'Last Change') unless $omit_age_column;
5539
print "<th></th>\n" . # for links
5540
"</tr>\n";
5541
}