summaryrefslogtreecommitdiffabout
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
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 (more/less context) (ignore whitespace changes)
-rw-r--r--cgit.h1
-rw-r--r--shared.c3
-rw-r--r--ui-summary.c10
3 files changed, 11 insertions, 3 deletions
diff --git a/cgit.h b/cgit.h
index 75e919b..53e1336 100644
--- a/cgit.h
+++ b/cgit.h
@@ -140,12 +140,13 @@ extern int cgit_max_lock_attempts;
extern int cgit_cache_root_ttl;
extern int cgit_cache_repo_ttl;
extern int cgit_cache_dynamic_ttl;
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_max_msg_len;
extern int cgit_max_repodesc_len;
extern int cgit_max_commit_count;
extern int cgit_query_has_symref;
diff --git a/shared.c b/shared.c
index d815cb1..7e5eaba 100644
--- a/shared.c
+++ b/shared.c
@@ -35,12 +35,13 @@ int cgit_max_lock_attempts = 5;
int cgit_cache_root_ttl = 5;
int cgit_cache_repo_ttl = 5;
int cgit_cache_dynamic_ttl = 5;
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_renamelimit = -1;
int cgit_max_msg_len = 60;
int cgit_max_repodesc_len = 60;
int cgit_max_commit_count = 50;
@@ -178,12 +179,14 @@ void cgit_global_config_cb(const char *name, const char *value)
else if (!strcmp(name, "max-repodesc-length"))
cgit_max_repodesc_len = atoi(value);
else if (!strcmp(name, "max-commit-count"))
cgit_max_commit_count = atoi(value);
else if (!strcmp(name, "summary-log"))
cgit_summary_log = atoi(value);
+ else if (!strcmp(name, "summary-tags"))
+ cgit_summary_tags = atoi(value);
else if (!strcmp(name, "agefile"))
cgit_agefile = xstrdup(value);
else if (!strcmp(name, "renamelimit"))
cgit_renamelimit = atoi(value);
else if (!strcmp(name, "repo.group"))
cgit_repo_group = xstrdup(value);
diff --git a/ui-summary.c b/ui-summary.c
index 43582da..3d5eda8 100644
--- a/ui-summary.c
+++ b/ui-summary.c
@@ -159,26 +159,30 @@ static void cgit_print_branches()
list.alloc = list.count = 0;
for_each_branch_ref(cgit_refs_cb, &list);
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;
header = 0;
list.refs = NULL;
list.alloc = list.count = 0;
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()
{
header = 0;
@@ -203,9 +207,9 @@ void cgit_print_summary()
cgit_print_log(cgit_query_head, 0, cgit_summary_log, NULL, NULL, 0);
html("<table class='list nowrap'>");
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>");
}