Skip to content

Commit

Permalink
gitweb: Allow configuring the default projects order and add order 'n…
Browse files Browse the repository at this point in the history
…one'

Introduce new configuration variable $default_projects_order
that can be used to specify the default order of projects on
the index page if no 'o' parameter is given.

Allow a new value 'none' for order that will cause the projects
to be in the order we learned about them. In case of reading the
list of projects from a file, this should be the order as they are
listed in the file. In case of reading the list of projects from
a directory this will probably give random results depending on the
filesystem in use.

Signed-off-by: Frank Lichtenheld <frank@lichtenheld.de>
Acked-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Junio C Hamano <junkio@cox.net>
  • Loading branch information
Frank Lichtenheld authored and Junio C Hamano committed Apr 11, 2007
1 parent c2b8b13 commit b06dcf8
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions gitweb/gitweb.perl
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ BEGIN
# source of projects list
our $projects_list = "++GITWEB_LIST++";

# default order of projects list
# valid values are none, project, descr, owner, and age
our $default_projects_order = "project";

# show repository only if this file exists
# (only effective if this variable evaluates to true)
our $export_ok = "++GITWEB_EXPORT_OK++";
Expand Down Expand Up @@ -1131,7 +1135,6 @@ sub git_get_projects_list {
}
close $fd;
}
@list = sort {$a->{'path'} cmp $b->{'path'}} @list;
return @list;
}

Expand Down Expand Up @@ -2618,7 +2621,7 @@ sub git_project_list_body {
push @projects, $pr;
}

$order ||= "project";
$order ||= $default_projects_order;
$from = 0 unless defined $from;
$to = $#projects if (!defined $to || $#projects < $to);

Expand Down Expand Up @@ -2977,7 +2980,7 @@ sub git_search_grep_body {

sub git_project_list {
my $order = $cgi->param('o');
if (defined $order && $order !~ m/project|descr|owner|age/) {
if (defined $order && $order !~ m/none|project|descr|owner|age/) {
die_error(undef, "Unknown order parameter");
}

Expand All @@ -3000,7 +3003,7 @@ sub git_project_list {

sub git_forks {
my $order = $cgi->param('o');
if (defined $order && $order !~ m/project|descr|owner|age/) {
if (defined $order && $order !~ m/none|project|descr|owner|age/) {
die_error(undef, "Unknown order parameter");
}

Expand Down

0 comments on commit b06dcf8

Please sign in to comment.