diff options
author | Lars Hjemli <hjemli@gmail.com> | 2007-10-25 17:40:16 (JST) |
---|---|---|
committer | Lars Hjemli <hjemli@gmail.com> | 2007-10-27 17:53:27 (JST) |
commit | fe211c7eef6c7d3e39486d6a7484d3b4debff88f (patch) | |
tree | 1b77d4b541cd5848ae1ad8d48e17e7d0f1a8b017 | |
parent | ef1cc6ef941cedf2e34fa1ed34ca8cd8a0cfdacc (diff) | |
download | cgit-fe211c7eef6c7d3e39486d6a7484d3b4debff88f.zip cgit-fe211c7eef6c7d3e39486d6a7484d3b4debff88f.tar.gz |
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>
-rw-r--r-- | cgit.h | 1 | ||||
-rw-r--r-- | shared.c | 3 | ||||
-rw-r--r-- | ui-summary.c | 10 |
3 files changed, 11 insertions, 3 deletions
@@ -143,6 +143,7 @@ extern int cgit_cache_dynamic_ttl; | |||
143 | extern int cgit_cache_static_ttl; | 143 | extern int cgit_cache_static_ttl; |
144 | extern int cgit_cache_max_create_time; | 144 | extern int cgit_cache_max_create_time; |
145 | extern int cgit_summary_log; | 145 | extern int cgit_summary_log; |
146 | extern int cgit_summary_tags; | ||
146 | 147 | ||
147 | extern int cgit_max_msg_len; | 148 | extern int cgit_max_msg_len; |
148 | extern int cgit_max_repodesc_len; | 149 | extern int cgit_max_repodesc_len; |
@@ -38,6 +38,7 @@ int cgit_cache_dynamic_ttl = 5; | |||
38 | int cgit_cache_static_ttl = -1; | 38 | int cgit_cache_static_ttl = -1; |
39 | int cgit_cache_max_create_time = 5; | 39 | int cgit_cache_max_create_time = 5; |
40 | int cgit_summary_log = 0; | 40 | int cgit_summary_log = 0; |
41 | int cgit_summary_tags = 0; | ||
41 | int cgit_renamelimit = -1; | 42 | int cgit_renamelimit = -1; |
42 | 43 | ||
43 | int cgit_max_msg_len = 60; | 44 | int cgit_max_msg_len = 60; |
@@ -181,6 +182,8 @@ void cgit_global_config_cb(const char *name, const char *value) | |||
181 | cgit_max_commit_count = atoi(value); | 182 | cgit_max_commit_count = atoi(value); |
182 | else if (!strcmp(name, "summary-log")) | 183 | else if (!strcmp(name, "summary-log")) |
183 | cgit_summary_log = atoi(value); | 184 | cgit_summary_log = atoi(value); |
185 | else if (!strcmp(name, "summary-tags")) | ||
186 | cgit_summary_tags = atoi(value); | ||
184 | else if (!strcmp(name, "agefile")) | 187 | else if (!strcmp(name, "agefile")) |
185 | cgit_agefile = xstrdup(value); | 188 | cgit_agefile = xstrdup(value); |
186 | else if (!strcmp(name, "renamelimit")) | 189 | else if (!strcmp(name, "renamelimit")) |
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() | |||
162 | cgit_print_branch(list.refs[i]); | 162 | cgit_print_branch(list.refs[i]); |
163 | } | 163 | } |
164 | 164 | ||
165 | static void cgit_print_tags() | 165 | static void cgit_print_tags(int maxcount) |
166 | { | 166 | { |
167 | struct reflist list; | 167 | struct reflist list; |
168 | int i; | 168 | int i; |
@@ -174,8 +174,12 @@ static void cgit_print_tags() | |||
174 | if (list.count == 0) | 174 | if (list.count == 0) |
175 | return; | 175 | return; |
176 | qsort(list.refs, list.count, sizeof(*list.refs), cmp_tag_age); | 176 | qsort(list.refs, list.count, sizeof(*list.refs), cmp_tag_age); |
177 | if (!maxcount) | ||
178 | maxcount = list.count; | ||
179 | else if (maxcount > list.count) | ||
180 | maxcount = list.count; | ||
177 | print_tag_header(); | 181 | print_tag_header(); |
178 | for(i=0; i<list.count; i++) | 182 | for(i=0; i<maxcount; i++) |
179 | print_tag(list.refs[i]); | 183 | print_tag(list.refs[i]); |
180 | } | 184 | } |
181 | 185 | ||
@@ -206,6 +210,6 @@ void cgit_print_summary() | |||
206 | html("<tr class='nohover'><td colspan='4'> </td></tr>"); | 210 | html("<tr class='nohover'><td colspan='4'> </td></tr>"); |
207 | cgit_print_branches(); | 211 | cgit_print_branches(); |
208 | html("<tr class='nohover'><td colspan='4'> </td></tr>"); | 212 | html("<tr class='nohover'><td colspan='4'> </td></tr>"); |
209 | cgit_print_tags(); | 213 | cgit_print_tags(cgit_summary_tags); |
210 | html("</table>"); | 214 | html("</table>"); |
211 | } | 215 | } |