summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--cgit.h1
-rw-r--r--shared.c3
-rw-r--r--ui-summary.c31
3 files changed, 32 insertions, 3 deletions
diff --git a/cgit.h b/cgit.h
index 53e1336..bb0e64c 100644
--- a/cgit.h
+++ b/cgit.h
@@ -144,6 +144,7 @@ extern int cgit_cache_static_ttl;
extern int cgit_cache_max_create_time;
extern int cgit_summary_log;
extern int cgit_summary_tags;
+extern int cgit_summary_branches;
extern int cgit_max_msg_len;
extern int cgit_max_repodesc_len;
diff --git a/shared.c b/shared.c
index 7e5eaba..ff600db 100644
--- a/shared.c
+++ b/shared.c
@@ -39,6 +39,7 @@ int cgit_cache_static_ttl = -1;
int cgit_cache_max_create_time = 5;
int cgit_summary_log = 0;
int cgit_summary_tags = 0;
+int cgit_summary_branches = 0;
int cgit_renamelimit = -1;
int cgit_max_msg_len = 60;
@@ -182,6 +183,8 @@ void cgit_global_config_cb(const char *name, const char *value)
cgit_max_commit_count = atoi(value);
else if (!strcmp(name, "summary-log"))
cgit_summary_log = atoi(value);
+ else if (!strcmp(name, "summary-branches"))
+ cgit_summary_branches = atoi(value);
else if (!strcmp(name, "summary-tags"))
cgit_summary_tags = atoi(value);
else if (!strcmp(name, "agefile"))
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>");
n-ready; lots of documentationnecoro15-81/+351 2007-04-18nomsgnecoro1-1/+0 2007-04-18finished Qt-Frontendnecoro5-15/+117 2007-04-17marking installed packages in pkglistnecoro5-14/+50 2007-04-16added ebuild window for Qt-Frontendnecoro4-2/+229 2007-04-16added preferences for Qt-Frontendnecoro9-279/+710 2007-04-13Improved masking display and made most of the Qt-Frontend worknecoro7-35/+334 2007-04-10Some more functionality for the Qt-Frontend (complete emerge)necoro8-217/+347 2007-04-07Some more functionality for the Qt-Frontendnecoro11-88/+463 2007-04-07Added Qt-Terminalnecoro4-4/+213 2007-04-06First qt draftnecoro6-1/+796 2007-04-04showed masked packages unmasked by the user similar to stable marked testing ...necoro5-13/+40 2007-03-31changed changelognecoro1-1/+2 2007-03-31Some small changes for etcproposals 1.1necoro1-2/+2 2007-03-31Some small changes for etcproposals 1.1necoro2-3/+3 2007-03-31Some small changes for etcproposals 1.1necoro1-6/+13 2007-03-31Allowed Plugins to have a menunecoro7-201/+315 2007-03-15Added etc-proposals pluginnecoro7-28/+121 2007-03-10Added USE_EXPAND-supportnecoro5-11/+63 2007-03-10Added plugin-data to about-dialognecoro3-197/+264