summaryrefslogtreecommitdiffabout
path: root/ui-summary.c
authorLars Hjemli <hjemli@gmail.com>2007-10-25 08:40:16 (UTC)
committer Lars Hjemli <hjemli@gmail.com>2007-10-27 08:53:27 (UTC)
commitfe211c7eef6c7d3e39486d6a7484d3b4debff88f (patch) (side-by-side diff)
tree1b77d4b541cd5848ae1ad8d48e17e7d0f1a8b017 /ui-summary.c
parentef1cc6ef941cedf2e34fa1ed34ca8cd8a0cfdacc (diff)
downloadcgit-fe211c7eef6c7d3e39486d6a7484d3b4debff88f.zip
cgit-fe211c7eef6c7d3e39486d6a7484d3b4debff88f.tar.gz
cgit-fe211c7eef6c7d3e39486d6a7484d3b4debff88f.tar.bz2
Add support for config param summary-tags
This parameter can be used to specify max number of tags to show on the summary page. If not specified, all tags are printed. Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Diffstat (limited to 'ui-summary.c') (more/less context) (ignore whitespace changes)
-rw-r--r--ui-summary.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/ui-summary.c b/ui-summary.c
index 43582da..3d5eda8 100644
--- a/ui-summary.c
+++ b/ui-summary.c
@@ -161,9 +161,9 @@ static void cgit_print_branches()
for(i=0; i<list.count; i++)
cgit_print_branch(list.refs[i]);
}
-static void cgit_print_tags()
+static void cgit_print_tags(int maxcount)
{
struct reflist list;
int i;
@@ -173,10 +173,14 @@ static void cgit_print_tags()
for_each_tag_ref(cgit_refs_cb, &list);
if (list.count == 0)
return;
qsort(list.refs, list.count, sizeof(*list.refs), cmp_tag_age);
+ if (!maxcount)
+ maxcount = list.count;
+ else if (maxcount > list.count)
+ maxcount = list.count;
print_tag_header();
- for(i=0; i<list.count; i++)
+ for(i=0; i<maxcount; i++)
print_tag(list.refs[i]);
}
static void cgit_print_archives()
@@ -205,7 +209,7 @@ void cgit_print_summary()
if (cgit_summary_log > 0)
html("<tr class='nohover'><td colspan='4'>&nbsp;</td></tr>");
cgit_print_branches();
html("<tr class='nohover'><td colspan='4'>&nbsp;</td></tr>");
- cgit_print_tags();
+ cgit_print_tags(cgit_summary_tags);
html("</table>");
}