From: Matthew Daley <mattjd@gmail.com>
To: git@vger.kernel.org
Cc: Matthew Daley <mattjd@gmail.com>
Subject: [PATCH] gitweb: Sort projects with undefined ages last
Date: Mon, 10 Dec 2012 17:34:21 +1300 [thread overview]
Message-ID: <1355114061-4652-1-git-send-email-mattjd@gmail.com> (raw)
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 <mattjd@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
next reply other threads:[~2012-12-10 4:34 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-10 4:34 Matthew Daley [this message]
2012-12-10 6:16 ` [PATCH] gitweb: Sort projects with undefined ages last Junio C Hamano
2012-12-11 10:56 ` Matthew Daley
2012-12-11 18:08 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1355114061-4652-1-git-send-email-mattjd@gmail.com \
--to=mattjd@gmail.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).