author | Lars Hjemli <hjemli@gmail.com> | 2007-10-27 08:25:40 (UTC) |
---|---|---|
committer | Lars Hjemli <hjemli@gmail.com> | 2007-10-27 08:53:27 (UTC) |
commit | 8efb05f98ad389d1b7f5aac17838401908622dad (patch) (unidiff) | |
tree | 100c407d28215fab0e5d2936c939ff39ec5290fc | |
parent | 6bce91be1a60b46270c69c4098a8c03f47dae63a (diff) | |
download | cgit-8efb05f98ad389d1b7f5aac17838401908622dad.zip cgit-8efb05f98ad389d1b7f5aac17838401908622dad.tar.gz cgit-8efb05f98ad389d1b7f5aac17838401908622dad.tar.bz2 |
Make cgit_print_branches()/cgit_print_tags() external
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
-rw-r--r-- | cgit.h | 2 | ||||
-rw-r--r-- | ui-summary.c | 4 |
2 files changed, 4 insertions, 2 deletions
@@ -238,32 +238,34 @@ extern void cgit_commit_link(char *name, char *title, char *class, char *head, | |||
238 | extern void cgit_snapshot_link(char *name, char *title, char *class, | 238 | extern void cgit_snapshot_link(char *name, char *title, char *class, |
239 | char *head, char *rev, char *archivename); | 239 | char *head, char *rev, char *archivename); |
240 | extern void cgit_diff_link(char *name, char *title, char *class, char *head, | 240 | extern void cgit_diff_link(char *name, char *title, char *class, char *head, |
241 | char *new_rev, char *old_rev, char *path); | 241 | char *new_rev, char *old_rev, char *path); |
242 | 242 | ||
243 | extern void cgit_object_link(struct object *obj); | 243 | extern void cgit_object_link(struct object *obj); |
244 | 244 | ||
245 | extern void cgit_print_error(char *msg); | 245 | extern void cgit_print_error(char *msg); |
246 | extern void cgit_print_date(time_t secs, char *format); | 246 | extern void cgit_print_date(time_t secs, char *format); |
247 | extern void cgit_print_age(time_t t, time_t max_relative, char *format); | 247 | extern void cgit_print_age(time_t t, time_t max_relative, char *format); |
248 | extern void cgit_print_docstart(char *title, struct cacheitem *item); | 248 | extern void cgit_print_docstart(char *title, struct cacheitem *item); |
249 | extern void cgit_print_docend(); | 249 | extern void cgit_print_docend(); |
250 | extern void cgit_print_pageheader(char *title, int show_search); | 250 | extern void cgit_print_pageheader(char *title, int show_search); |
251 | extern void cgit_print_snapshot_start(const char *mimetype, | 251 | extern void cgit_print_snapshot_start(const char *mimetype, |
252 | const char *filename, | 252 | const char *filename, |
253 | struct cacheitem *item); | 253 | struct cacheitem *item); |
254 | extern void cgit_print_branches(int maxcount); | ||
255 | extern void cgit_print_tags(int maxcount); | ||
254 | 256 | ||
255 | extern void cgit_print_repolist(struct cacheitem *item); | 257 | extern void cgit_print_repolist(struct cacheitem *item); |
256 | extern void cgit_print_summary(); | 258 | extern void cgit_print_summary(); |
257 | extern void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *path, int pager); | 259 | extern void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *path, int pager); |
258 | extern void cgit_print_blob(struct cacheitem *item, const char *hex, char *path); | 260 | extern void cgit_print_blob(struct cacheitem *item, const char *hex, char *path); |
259 | extern void cgit_print_tree(const char *rev, char *path); | 261 | extern void cgit_print_tree(const char *rev, char *path); |
260 | extern void cgit_print_commit(char *hex); | 262 | extern void cgit_print_commit(char *hex); |
261 | extern void cgit_print_tag(char *revname); | 263 | extern void cgit_print_tag(char *revname); |
262 | extern void cgit_print_diff(const char *new_hex, const char *old_hex, const char *prefix); | 264 | extern void cgit_print_diff(const char *new_hex, const char *old_hex, const char *prefix); |
263 | extern void cgit_print_snapshot(struct cacheitem *item, const char *head, | 265 | extern void cgit_print_snapshot(struct cacheitem *item, const char *head, |
264 | const char *hex, const char *prefix, | 266 | const char *hex, const char *prefix, |
265 | const char *filename, int snapshot); | 267 | const char *filename, int snapshot); |
266 | extern void cgit_print_snapshot_links(const char *repo, const char *head, | 268 | extern void cgit_print_snapshot_links(const char *repo, const char *head, |
267 | const char *hex, int snapshots); | 269 | const char *hex, int snapshots); |
268 | extern int cgit_parse_snapshots_mask(const char *str); | 270 | extern int cgit_parse_snapshots_mask(const char *str); |
269 | 271 | ||
diff --git a/ui-summary.c b/ui-summary.c index df79d01..97f1b57 100644 --- a/ui-summary.c +++ b/ui-summary.c | |||
@@ -153,59 +153,59 @@ static int cgit_print_archive_cb(const char *refname, const unsigned char *sha1, | |||
153 | if (!header) { | 153 | if (!header) { |
154 | html("<table id='downloads'>"); | 154 | html("<table id='downloads'>"); |
155 | html("<tr><th>Downloads</th></tr>"); | 155 | html("<tr><th>Downloads</th></tr>"); |
156 | header = 1; | 156 | header = 1; |
157 | } | 157 | } |
158 | html("<tr><td>"); | 158 | html("<tr><td>"); |
159 | url = cgit_pageurl(cgit_query_repo, "blob", | 159 | url = cgit_pageurl(cgit_query_repo, "blob", |
160 | fmt("id=%s&path=%s", sha1_to_hex(fileid), | 160 | fmt("id=%s&path=%s", sha1_to_hex(fileid), |
161 | buf)); | 161 | buf)); |
162 | html_link_open(url, NULL, NULL); | 162 | html_link_open(url, NULL, NULL); |
163 | html_txt(buf); | 163 | html_txt(buf); |
164 | html_link_close(); | 164 | html_link_close(); |
165 | html("</td></tr>"); | 165 | html("</td></tr>"); |
166 | return 0; | 166 | return 0; |
167 | } | 167 | } |
168 | 168 | ||
169 | static void cgit_print_branches(int maxcount) | 169 | void cgit_print_branches(int maxcount) |
170 | { | 170 | { |
171 | struct reflist list; | 171 | struct reflist list; |
172 | int i; | 172 | int i; |
173 | 173 | ||
174 | html("<tr class='nohover'><th class='left'>Branch</th>" | 174 | html("<tr class='nohover'><th class='left'>Branch</th>" |
175 | "<th class='left'>Idle</th>" | 175 | "<th class='left'>Idle</th>" |
176 | "<th class='left'>Author</th>" | 176 | "<th class='left'>Author</th>" |
177 | "<th class='left'>Head commit</th></tr>\n"); | 177 | "<th class='left'>Head commit</th></tr>\n"); |
178 | 178 | ||
179 | list.refs = NULL; | 179 | list.refs = NULL; |
180 | list.alloc = list.count = 0; | 180 | list.alloc = list.count = 0; |
181 | for_each_branch_ref(cgit_refs_cb, &list); | 181 | for_each_branch_ref(cgit_refs_cb, &list); |
182 | 182 | ||
183 | if (maxcount == 0 || maxcount > list.count) | 183 | if (maxcount == 0 || maxcount > list.count) |
184 | maxcount = list.count; | 184 | maxcount = list.count; |
185 | 185 | ||
186 | if (maxcount < list.count) { | 186 | if (maxcount < list.count) { |
187 | qsort(list.refs, list.count, sizeof(*list.refs), cmp_branch_age); | 187 | qsort(list.refs, list.count, sizeof(*list.refs), cmp_branch_age); |
188 | qsort(list.refs, maxcount, sizeof(*list.refs), cmp_ref_name); | 188 | qsort(list.refs, maxcount, sizeof(*list.refs), cmp_ref_name); |
189 | } | 189 | } |
190 | 190 | ||
191 | for(i=0; i<maxcount; i++) | 191 | for(i=0; i<maxcount; i++) |
192 | cgit_print_branch(list.refs[i]); | 192 | cgit_print_branch(list.refs[i]); |
193 | } | 193 | } |
194 | 194 | ||
195 | static void cgit_print_tags(int maxcount) | 195 | void cgit_print_tags(int maxcount) |
196 | { | 196 | { |
197 | struct reflist list; | 197 | struct reflist list; |
198 | int i; | 198 | int i; |
199 | 199 | ||
200 | header = 0; | 200 | header = 0; |
201 | list.refs = NULL; | 201 | list.refs = NULL; |
202 | list.alloc = list.count = 0; | 202 | list.alloc = list.count = 0; |
203 | for_each_tag_ref(cgit_refs_cb, &list); | 203 | for_each_tag_ref(cgit_refs_cb, &list); |
204 | if (list.count == 0) | 204 | if (list.count == 0) |
205 | return; | 205 | return; |
206 | qsort(list.refs, list.count, sizeof(*list.refs), cmp_tag_age); | 206 | qsort(list.refs, list.count, sizeof(*list.refs), cmp_tag_age); |
207 | if (!maxcount) | 207 | if (!maxcount) |
208 | maxcount = list.count; | 208 | maxcount = list.count; |
209 | else if (maxcount > list.count) | 209 | else if (maxcount > list.count) |
210 | maxcount = list.count; | 210 | maxcount = list.count; |
211 | print_tag_header(); | 211 | print_tag_header(); |