summaryrefslogtreecommitdiff
path: root/ui-summary.c
diff options
context:
space:
mode:
authorLars Hjemli <hjemli@gmail.com>2007-10-25 08:40:16 +0000
committerLars Hjemli <hjemli@gmail.com>2007-10-27 08:53:27 +0000
commitfe211c7eef6c7d3e39486d6a7484d3b4debff88f (patch)
tree1b77d4b541cd5848ae1ad8d48e17e7d0f1a8b017 /ui-summary.c
parentef1cc6ef941cedf2e34fa1ed34ca8cd8a0cfdacc (diff)
downloadcgit-fe211c7eef6c7d3e39486d6a7484d3b4debff88f.tar
cgit-fe211c7eef6c7d3e39486d6a7484d3b4debff88f.tar.gz
cgit-fe211c7eef6c7d3e39486d6a7484d3b4debff88f.zip
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')
-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
@@ -162,7 +162,7 @@ static void cgit_print_branches()
cgit_print_branch(list.refs[i]);
}
-static void cgit_print_tags()
+static void cgit_print_tags(int maxcount)
{
struct reflist list;
int i;
@@ -174,8 +174,12 @@ static void cgit_print_tags()
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]);
}
@@ -206,6 +210,6 @@ void cgit_print_summary()
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>");
}