From 79f2ef6cae893e47665cc14e67e0074c0d56a6cf Mon Sep 17 00:00:00 2001 From: Petr Baudis Date: Thu, 25 Sep 2008 18:05:41 +0200 Subject: [PATCH] [PATCH] gitweb: Sort the list of forks on the summary page by age --- .topdeps | 1 + .topmsg | 18 ++++++++++++++++++ gitweb/gitweb.perl | 7 +++++-- 3 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 .topdeps create mode 100644 .topmsg diff --git a/.topdeps b/.topdeps new file mode 100644 index 0000000000..43b8c659cb --- /dev/null +++ b/.topdeps @@ -0,0 +1 @@ +vanilla/master diff --git a/.topmsg b/.topmsg new file mode 100644 index 0000000000..4fe93b3116 --- /dev/null +++ b/.topmsg @@ -0,0 +1,18 @@ +From: Petr Baudis +To: git@vger.kernel.org +Subject: [PATCH] gitweb: Sort the list of forks on the summary page by age + +From: Mike Ralphson + +The list of forks on the summary page was unsorted, this just makes +them sorted by age, which seems a fair way to decide which forks are +shown before the list size cut-off (15) kicks in. + +s/noheader/no_header was just to make it obvious what the parameter +affects, so all the code can be found with one grep, and s/undef/'age' +just shows the intent, although that parameter isn't what actually +controls the sort order. Or, I guess, the sorting could be refactored +out of the header generation code. + +Signed-off-by: Mike Ralphson +Signed-off-by: Petr Baudis diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl index da474d082c..15a05907fc 100755 --- a/gitweb/gitweb.perl +++ b/gitweb/gitweb.perl @@ -3662,6 +3662,9 @@ sub git_project_list_body { print "\n" . # for links "\n"; } + else { + @projects = sort {$a->{'age'} <=> $b->{'age'}} @projects; + } my $alternate = 1; for (my $i = $from; $i <= $to; $i++) { my $pr = $projects[$i]; @@ -4124,10 +4127,10 @@ sub git_summary { if (@forklist) { git_print_header_div('forks'); - git_project_list_body(\@forklist, undef, 0, 15, + git_project_list_body(\@forklist, 'age', 0, 15, $#forklist <= 15 ? undef : $cgi->a({-href => href(action=>"forks")}, "..."), - 'noheader'); + 'no_header'); } git_footer_html(); -- 2.11.4.GIT