1
0

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>
Este cometimento está contido em:
Lars Hjemli 2007-10-25 10:40:16 +02:00
ascendente ef1cc6ef94
cometimento fe211c7eef
3 ficheiros modificados com 11 adições e 3 eliminações

1
cgit.h
Ver ficheiro

@ -143,6 +143,7 @@ extern int cgit_cache_dynamic_ttl;
extern int cgit_cache_static_ttl; extern int cgit_cache_static_ttl;
extern int cgit_cache_max_create_time; extern int cgit_cache_max_create_time;
extern int cgit_summary_log; extern int cgit_summary_log;
extern int cgit_summary_tags;
extern int cgit_max_msg_len; extern int cgit_max_msg_len;
extern int cgit_max_repodesc_len; extern int cgit_max_repodesc_len;

Ver ficheiro

@ -38,6 +38,7 @@ int cgit_cache_dynamic_ttl = 5;
int cgit_cache_static_ttl = -1; int cgit_cache_static_ttl = -1;
int cgit_cache_max_create_time = 5; int cgit_cache_max_create_time = 5;
int cgit_summary_log = 0; int cgit_summary_log = 0;
int cgit_summary_tags = 0;
int cgit_renamelimit = -1; int cgit_renamelimit = -1;
int cgit_max_msg_len = 60; int cgit_max_msg_len = 60;
@ -181,6 +182,8 @@ void cgit_global_config_cb(const char *name, const char *value)
cgit_max_commit_count = atoi(value); cgit_max_commit_count = atoi(value);
else if (!strcmp(name, "summary-log")) else if (!strcmp(name, "summary-log"))
cgit_summary_log = atoi(value); cgit_summary_log = atoi(value);
else if (!strcmp(name, "summary-tags"))
cgit_summary_tags = atoi(value);
else if (!strcmp(name, "agefile")) else if (!strcmp(name, "agefile"))
cgit_agefile = xstrdup(value); cgit_agefile = xstrdup(value);
else if (!strcmp(name, "renamelimit")) else if (!strcmp(name, "renamelimit"))

Ver ficheiro

@ -162,7 +162,7 @@ static void cgit_print_branches()
cgit_print_branch(list.refs[i]); cgit_print_branch(list.refs[i]);
} }
static void cgit_print_tags() static void cgit_print_tags(int maxcount)
{ {
struct reflist list; struct reflist list;
int i; int i;
@ -174,8 +174,12 @@ static void cgit_print_tags()
if (list.count == 0) if (list.count == 0)
return; return;
qsort(list.refs, list.count, sizeof(*list.refs), cmp_tag_age); 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(); print_tag_header();
for(i=0; i<list.count; i++) for(i=0; i<maxcount; i++)
print_tag(list.refs[i]); print_tag(list.refs[i]);
} }
@ -206,6 +210,6 @@ void cgit_print_summary()
html("<tr class='nohover'><td colspan='4'>&nbsp;</td></tr>"); html("<tr class='nohover'><td colspan='4'>&nbsp;</td></tr>");
cgit_print_branches(); cgit_print_branches();
html("<tr class='nohover'><td colspan='4'>&nbsp;</td></tr>"); html("<tr class='nohover'><td colspan='4'>&nbsp;</td></tr>");
cgit_print_tags(); cgit_print_tags(cgit_summary_tags);
html("</table>"); html("</table>");
} }