summaryrefslogtreecommitdiffabout
path: root/ui-summary.c
Unidiff
Diffstat (limited to 'ui-summary.c') (more/less context) (show whitespace changes)
-rw-r--r--ui-summary.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/ui-summary.c b/ui-summary.c
index 15e8aec..4bda4c2 100644
--- a/ui-summary.c
+++ b/ui-summary.c
@@ -1,45 +1,48 @@
1/* ui-summary.c: functions for generating repo summary page 1/* ui-summary.c: functions for generating repo summary page
2 * 2 *
3 * Copyright (C) 2006 Lars Hjemli 3 * Copyright (C) 2006 Lars Hjemli
4 * 4 *
5 * Licensed under GNU General Public License v2 5 * Licensed under GNU General Public License v2
6 * (see COPYING for full license text) 6 * (see COPYING for full license text)
7 */ 7 */
8 8
9#include "cgit.h" 9#include "cgit.h"
10 10
11static int header; 11static int header;
12 12
13static int cgit_print_branch_cb(const char *refname, const unsigned char *sha1, 13static int cgit_print_branch_cb(const char *refname, const unsigned char *sha1,
14 int flags, void *cb_data) 14 int flags, void *cb_data)
15{ 15{
16 struct commit *commit; 16 struct commit *commit;
17 struct commitinfo *info; 17 struct commitinfo *info;
18 char buf[256], *url; 18 char buf[256], *url;
19 19
20 strncpy(buf, refname, sizeof(buf)); 20 strncpy(buf, refname, sizeof(buf));
21 commit = lookup_commit(sha1); 21 commit = lookup_commit(sha1);
22 // object is not really parsed at this point, because of some fallout
23 // from previous calls to git functions in cgit_print_log()
24 commit->object.parsed = 0;
22 if (commit && !parse_commit(commit)){ 25 if (commit && !parse_commit(commit)){
23 info = cgit_parse_commit(commit); 26 info = cgit_parse_commit(commit);
24 html("<tr><td>"); 27 html("<tr><td>");
25 url = cgit_pageurl(cgit_query_repo, "log", 28 url = cgit_pageurl(cgit_query_repo, "log",
26 fmt("h=%s", refname)); 29 fmt("h=%s", refname));
27 html_link_open(url, NULL, NULL); 30 html_link_open(url, NULL, NULL);
28 html_txt(buf); 31 html_txt(buf);
29 html_link_close(); 32 html_link_close();
30 html("</td><td>"); 33 html("</td><td>");
31 cgit_print_age(commit->date, -1, NULL); 34 cgit_print_age(commit->date, -1, NULL);
32 html("</td><td>"); 35 html("</td><td>");
33 html_txt(info->author); 36 html_txt(info->author);
34 html("</td><td>"); 37 html("</td><td>");
35 url = cgit_pageurl(cgit_query_repo, "commit", 38 url = cgit_pageurl(cgit_query_repo, "commit",
36 fmt("h=%s", sha1_to_hex(sha1))); 39 fmt("h=%s", sha1_to_hex(sha1)));
37 html_link_open(url, NULL, NULL); 40 html_link_open(url, NULL, NULL);
38 html_ntxt(cgit_max_msg_len, info->subject); 41 html_ntxt(cgit_max_msg_len, info->subject);
39 html_link_close(); 42 html_link_close();
40 html("</td></tr>\n"); 43 html("</td></tr>\n");
41 cgit_free_commitinfo(info); 44 cgit_free_commitinfo(info);
42 } else { 45 } else {
43 html("<tr><td>"); 46 html("<tr><td>");
44 html_txt(buf); 47 html_txt(buf);
45 html("</td><td colspan='3'>"); 48 html("</td><td colspan='3'>");
@@ -182,31 +185,34 @@ static void cgit_print_tags()
182 header = 0; 185 header = 0;
183 for_each_tag_ref(cgit_print_tag_cb, NULL); 186 for_each_tag_ref(cgit_print_tag_cb, NULL);
184} 187}
185 188
186static void cgit_print_archives() 189static void cgit_print_archives()
187{ 190{
188 header = 0; 191 header = 0;
189 for_each_ref(cgit_print_archive_cb, NULL); 192 for_each_ref(cgit_print_archive_cb, NULL);
190 if (header) 193 if (header)
191 html("</table>"); 194 html("</table>");
192} 195}
193 196
194void cgit_print_summary() 197void cgit_print_summary()
195{ 198{
196 html("<div id='summary'>"); 199 html("<div id='summary'>");
197 cgit_print_archives(); 200 cgit_print_archives();
198 html("<h2>"); 201 html("<h2>");
199 html_txt(cgit_repo->name); 202 html_txt(cgit_repo->name);
200 html(" - "); 203 html(" - ");
201 html_txt(cgit_repo->desc); 204 html_txt(cgit_repo->desc);
202 html("</h2>"); 205 html("</h2>");
203 if (cgit_repo->readme) 206 if (cgit_repo->readme)
204 html_include(cgit_repo->readme); 207 html_include(cgit_repo->readme);
205 html("</div>"); 208 html("</div>");
206 209 if (cgit_summary_log > 0)
210 cgit_print_log(cgit_query_head, 0, cgit_summary_log, NULL, NULL, 0);
207 html("<table class='list nowrap'>"); 211 html("<table class='list nowrap'>");
212 if (cgit_summary_log > 0)
213 html("<tr class='nohover'><td colspan='4'>&nbsp;</td></tr>");
208 cgit_print_branches(); 214 cgit_print_branches();
209 html("<tr class='nohover'><td colspan='4'>&nbsp;</td></tr>"); 215 html("<tr class='nohover'><td colspan='4'>&nbsp;</td></tr>");
210 cgit_print_tags(); 216 cgit_print_tags();
211 html("</table>"); 217 html("</table>");
212} 218}