Sorting gitweb's project list by age ('Last Change') currently shows
projects with undefined ages at the head of the list. This results in a
less useful result when there are a number of projects that are missing
or otherwise faulty and one is trying to see what projects have been
updated recently.

Fix by sorting these projects with undefined ages at the bottom of the
list when sorting by age.

Signed-off-by: Matthew Daley <mat...@gmail.com>
---
I realize this might be a bit bikesheddy, but it does improve the listing
in the given use case. For an example of the problem, see ie.
http://git.kernel.org/?o=age or http://repo.or.cz/w?a=project_list;o=age .

I'm also not a Perl native, so any advice on making the patch good Perl is
appreciated.

 gitweb/gitweb.perl |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 0f207f2..21da1b5 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -5541,7 +5541,9 @@ sub sort_projects_list {
        if ($oi->{'type'} eq 'str') {
                @projects = sort {$a->{$oi->{'key'}} cmp $b->{$oi->{'key'}}} 
@$projlist;
        } else {
-               @projects = sort {$a->{$oi->{'key'}} <=> $b->{$oi->{'key'}}} 
@$projlist;
+               @projects = sort {$a->{$oi->{'key'}} <=> $b->{$oi->{'key'}}}
+                           grep {defined $_->{$oi->{'key'}}} @$projlist;
+               push @projects, grep {!defined $_->{$oi->{'key'}}} @$projlist;
        }
 
        return @projects;
-- 
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to