summaryrefslogtreecommitdiff
path: root/ui-summary.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--ui-summary.c31
1 files changed, 28 insertions, 3 deletions
diff --git a/ui-summary.c b/ui-summary.c
index 05170cc..df79d01 100644
--- a/ui-summary.c
+++ b/ui-summary.c
@@ -24,6 +24,22 @@ static int cmp_age(int age1, int age2)
return -1;
}
+static int cmp_ref_name(const void *a, const void *b)
+{
+ struct refinfo *r1 = *(struct refinfo **)a;
+ struct refinfo *r2 = *(struct refinfo **)b;
+
+ return strcmp(r1->refname, r2->refname);
+}
+
+static int cmp_branch_age(const void *a, const void *b)
+{
+ struct refinfo *r1 = *(struct refinfo **)a;
+ struct refinfo *r2 = *(struct refinfo **)b;
+
+ return cmp_age(r1->commit->committer_date, r2->commit->committer_date);
+}
+
static int cmp_tag_age(const void *a, const void *b)
{
struct refinfo *r1 = *(struct refinfo **)a;
@@ -150,7 +166,7 @@ static int cgit_print_archive_cb(const char *refname, const unsigned char *sha1,
return 0;
}
-static void cgit_print_branches()
+static void cgit_print_branches(int maxcount)
{
struct reflist list;
int i;
@@ -163,7 +179,16 @@ static void cgit_print_branches()
list.refs = NULL;
list.alloc = list.count = 0;
for_each_branch_ref(cgit_refs_cb, &list);
- for(i=0; i<list.count; i++)
+
+ if (maxcount == 0 || maxcount > list.count)
+ maxcount = list.count;
+
+ if (maxcount < list.count) {
+ qsort(list.refs, list.count, sizeof(*list.refs), cmp_branch_age);
+ qsort(list.refs, maxcount, sizeof(*list.refs), cmp_ref_name);
+ }
+
+ for(i=0; i<maxcount; i++)
cgit_print_branch(list.refs[i]);
}
@@ -213,7 +238,7 @@ void cgit_print_summary()
html("<table class='list nowrap'>");
if (cgit_summary_log > 0)
html("<tr class='nohover'><td colspan='4'>&nbsp;</td></tr>");
- cgit_print_branches();
+ cgit_print_branches(cgit_summary_branches);
html("<tr class='nohover'><td colspan='4'>&nbsp;</td></tr>");
cgit_print_tags(cgit_summary_tags);
html("</table>");
o/gui/windows/mailinfo.py?h=flagrw&id=b105a2a9e9068463eaad97b402209e3b944b6501&follow=1'>First mail window draftRené 'Necoro' Neumann3-0/+220 2008-06-10Added gpytage pluginRené 'Necoro' Neumann2-0/+29 2008-06-10Modified plugin.xsd so it allows also menu-only pluginsRené 'Necoro' Neumann2-7/+8 2008-06-10Fixed the default handlingRené 'Necoro' Neumann1-1/+1 2008-06-10Allowed default for session; load 'app-portage/portato' as default for select...René 'Necoro' Neumann2-10/+18 2008-06-09Fixed 'kill' in the systray popupRené 'Necoro' Neumann1-2/+2 2008-06-09Fixed error messageRené 'Necoro' Neumann2-4/+1 2008-06-08Make blocks way more intelligentRené 'Necoro' Neumann3-45/+107