gitweb: Option to not display information about owner

In some setups the repository owner is not a well defined concept and administrator can prefer it to be not shown. This commit add and an option that enable to reach this effect. Signed-off-by: Kacper Kornet <draenog@pld-linux.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Kacper Kornet committed Apr 26, 2012 at 18:45 UTC 0ebe7827b6f00797ab850e8ebc28f0fa22f1df55
2 files changed +18 -6
Documentation/gitweb.conf.txt
+3
@@ -503,6 +503,9 @@ $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 +
509 $per_request_config::
510 If this is set to code reference, it will be run once for each request.
511 You can set parts of configuration that change per session this way.
gitweb/gitweb.perl
+15 -6
@@ -136,6 +136,9 @@ our $export_ok = "++GITWEB_EXPORT_OK++";
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 +
142 # show repository only if this subroutine returns true
143 # when given the path to the project, for example:
144 # sub { return -e "$_[0]/git-daemon-export-ok"; }
@@ -5465,8 +5468,10 @@ sub git_project_list_rows {
5468 ? esc_html_match_hl_chopped($pr->{'descr_long'},
5469 $pr->{'descr'}, $search_regexp)
5470 : esc_html($pr->{'descr'})) .
5468 - "</td>\n" .
5469 - "<td><i>" . chop_and_escape_str($pr->{'owner'}, 15) . "</i></td>\n";
5471 + "</td>\n";
5472 + unless ($omit_owner) {
5473 + print "<td><i>" . chop_and_escape_str($pr->{'owner'}, 15) . "</i></td>\n";
5474 + }
5475 unless ($omit_age_column) {
5476 print "<td class=\"". age_class($pr->{'age'}) . "\">" .
5477 (defined $pr->{'age_string'} ? $pr->{'age_string'} : "No commits") . "</td>\n";
@@ -5502,7 +5507,9 @@ sub git_project_list_body {
5507 'tagfilter' => $tagfilter)
5508 if ($tagfilter || $search_regexp);
5509 # fill the rest
5505 - my @all_fields = $omit_age_column ? ('descr', 'descr_long', 'owner', 'ctags', 'category') : ();
5510 + my @all_fields = ('descr', 'descr_long', 'ctags', 'category');
5511 + push @all_fields, ('age', 'age_string') unless($omit_age_column);
5512 + push @all_fields, 'owner' unless($omit_owner);
5513 @projects = fill_project_list_info(\@projects, @all_fields);
5514
5515 $order ||= $default_projects_order;
@@ -5534,7 +5541,7 @@ sub git_project_list_body {
5541 }
5542 print_sort_th('project', $order, 'Project');
5543 print_sort_th('descr', $order, 'Description');
5537 - print_sort_th('owner', $order, 'Owner');
5544 + print_sort_th('owner', $order, 'Owner') unless $omit_owner;
5545 print_sort_th('age', $order, 'Last Change') unless $omit_age_column;
5546 print "<th></th>\n" . # for links
5547 "</tr>\n";
@@ -6288,8 +6295,10 @@ sub git_summary {
6295
6296 print "<div class=\"title\">&nbsp;</div>\n";
6297 print "<table class=\"projects_list\">\n" .
6291 - "<tr id=\"metadata_desc\"><td>description</td><td>" . esc_html($descr) . "</td></tr>\n" .
6292 - "<tr id=\"metadata_owner\"><td>owner</td><td>" . esc_html($owner) . "</td></tr>\n";
6298 + "<tr id=\"metadata_desc\"><td>description</td><td>" . esc_html($descr) . "</td></tr>\n";
6299 + unless ($omit_owner) {
6300 + print "<tr id=\"metadata_owner\"><td>owner</td><td>" . esc_html($owner) . "</td></tr>\n";
6301 + }
6302 if (defined $cd{'rfc2822'}) {
6303 print "<tr id=\"metadata_lchange\"><td>last change</td>" .
6304 "<td>".format_timestamp_html(\%cd)."</td></tr>\n";