summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--cgit.css2
-rw-r--r--cgit.h1
-rw-r--r--html.c28
-rw-r--r--ui-log.c4
-rw-r--r--ui-summary.c4
5 files changed, 34 insertions, 5 deletions
diff --git a/cgit.css b/cgit.css
index 7b8e468..85815c1 100644
--- a/cgit.css
+++ b/cgit.css
@@ -55,97 +55,97 @@ div#header {
55 font-size: 150%; 55 font-size: 150%;
56 font-weight: bold; 56 font-weight: bold;
57 border: solid 1px #ccc; 57 border: solid 1px #ccc;
58 vertical-align: middle; 58 vertical-align: middle;
59} 59}
60div#header img#logo { 60div#header img#logo {
61 float: right; 61 float: right;
62} 62}
63div#header a { 63div#header a {
64 color: black; 64 color: black;
65} 65}
66 66
67div#content { 67div#content {
68 margin: 0.5em 0.5em; 68 margin: 0.5em 0.5em;
69} 69}
70 70
71div#blob { 71div#blob {
72 border: solid 1px black; 72 border: solid 1px black;
73} 73}
74 74
75div.error { 75div.error {
76 color: red; 76 color: red;
77 font-weight: bold; 77 font-weight: bold;
78 margin: 1em 2em; 78 margin: 1em 2em;
79} 79}
80div.ls-blob, div.ls-dir { 80div.ls-blob, div.ls-dir {
81 font-family: monospace; 81 font-family: monospace;
82} 82}
83div.ls-dir a { 83div.ls-dir a {
84 font-weight: bold; 84 font-weight: bold;
85} 85}
86th.filesize, td.filesize { 86th.filesize, td.filesize {
87 text-align: right; 87 text-align: right;
88} 88}
89td.filesize { 89td.filesize {
90 font-family: monospace; 90 font-family: monospace;
91} 91}
92td.filemode { 92td.filemode {
93 font-family: monospace; 93 font-family: monospace;
94} 94}
95 95
96td.blob { 96td.blob {
97 white-space: pre; 97 white-space: pre;
98 font-family: courier; 98 font-family: courier;
99 font-size: 100%; 99 font-size: 100%;
100 background-color: white; 100 background-color: white;
101} 101}
102 102
103table.log td { 103table.nowrap td {
104 white-space: nowrap; 104 white-space: nowrap;
105} 105}
106 106
107table.commit-info { 107table.commit-info {
108 border-collapse: collapse; 108 border-collapse: collapse;
109 margin-top: 1.5em; 109 margin-top: 1.5em;
110} 110}
111table.commit-info th { 111table.commit-info th {
112 text-align: left; 112 text-align: left;
113 font-weight: normal; 113 font-weight: normal;
114 padding: 0.1em 1em 0.1em 0.1em; 114 padding: 0.1em 1em 0.1em 0.1em;
115} 115}
116table.commit-info td { 116table.commit-info td {
117 font-weight: normal; 117 font-weight: normal;
118 padding: 0.1em 1em 0.1em 0.1em; 118 padding: 0.1em 1em 0.1em 0.1em;
119} 119}
120div.commit-subject { 120div.commit-subject {
121 font-weight: bold; 121 font-weight: bold;
122 font-size: 125%; 122 font-size: 125%;
123 margin: 1.5em 0em 0.5em 0em; 123 margin: 1.5em 0em 0.5em 0em;
124 padding: 0em; 124 padding: 0em;
125} 125}
126div.commit-msg { 126div.commit-msg {
127 white-space: pre; 127 white-space: pre;
128 font-family: monospace; 128 font-family: monospace;
129} 129}
130table.diffstat { 130table.diffstat {
131 border-collapse: collapse; 131 border-collapse: collapse;
132 margin-top: 1.5em; 132 margin-top: 1.5em;
133} 133}
134table.diffstat th { 134table.diffstat th {
135 font-weight: normal; 135 font-weight: normal;
136 text-align: left; 136 text-align: left;
137 text-decoration: underline; 137 text-decoration: underline;
138 padding: 0.1em 1em 0.1em 0.1em; 138 padding: 0.1em 1em 0.1em 0.1em;
139 font-size: 100%; 139 font-size: 100%;
140} 140}
141table.diffstat td { 141table.diffstat td {
142 padding: 0.1em 1em 0.1em 0.1em; 142 padding: 0.1em 1em 0.1em 0.1em;
143 font-size: 100%; 143 font-size: 100%;
144} 144}
145table.diffstat td span.modechange { 145table.diffstat td span.modechange {
146 padding-left: 1em; 146 padding-left: 1em;
147 color: red; 147 color: red;
148} 148}
149table.diffstat td.add a { 149table.diffstat td.add a {
150 color: green; 150 color: green;
151} 151}
diff --git a/cgit.h b/cgit.h
index bba2d6c..362b435 100644
--- a/cgit.h
+++ b/cgit.h
@@ -28,83 +28,84 @@ struct commitinfo {
28}; 28};
29 29
30extern const char cgit_version[]; 30extern const char cgit_version[];
31 31
32extern char *cgit_root; 32extern char *cgit_root;
33extern char *cgit_root_title; 33extern char *cgit_root_title;
34extern char *cgit_css; 34extern char *cgit_css;
35extern char *cgit_logo; 35extern char *cgit_logo;
36extern char *cgit_logo_link; 36extern char *cgit_logo_link;
37extern char *cgit_virtual_root; 37extern char *cgit_virtual_root;
38extern char *cgit_cache_root; 38extern char *cgit_cache_root;
39 39
40extern int cgit_nocache; 40extern int cgit_nocache;
41extern int cgit_max_lock_attempts; 41extern int cgit_max_lock_attempts;
42extern int cgit_cache_root_ttl; 42extern int cgit_cache_root_ttl;
43extern int cgit_cache_repo_ttl; 43extern int cgit_cache_repo_ttl;
44extern int cgit_cache_dynamic_ttl; 44extern int cgit_cache_dynamic_ttl;
45extern int cgit_cache_static_ttl; 45extern int cgit_cache_static_ttl;
46extern int cgit_cache_max_create_time; 46extern int cgit_cache_max_create_time;
47 47
48extern char *cgit_repo_name; 48extern char *cgit_repo_name;
49extern char *cgit_repo_desc; 49extern char *cgit_repo_desc;
50extern char *cgit_repo_owner; 50extern char *cgit_repo_owner;
51 51
52extern int cgit_query_has_symref; 52extern int cgit_query_has_symref;
53extern int cgit_query_has_sha1; 53extern int cgit_query_has_sha1;
54 54
55extern char *cgit_querystring; 55extern char *cgit_querystring;
56extern char *cgit_query_repo; 56extern char *cgit_query_repo;
57extern char *cgit_query_page; 57extern char *cgit_query_page;
58extern char *cgit_query_head; 58extern char *cgit_query_head;
59extern char *cgit_query_sha1; 59extern char *cgit_query_sha1;
60extern char *cgit_query_sha2; 60extern char *cgit_query_sha2;
61extern int cgit_query_ofs; 61extern int cgit_query_ofs;
62 62
63extern int htmlfd; 63extern int htmlfd;
64 64
65extern void cgit_global_config_cb(const char *name, const char *value); 65extern void cgit_global_config_cb(const char *name, const char *value);
66extern void cgit_repo_config_cb(const char *name, const char *value); 66extern void cgit_repo_config_cb(const char *name, const char *value);
67extern void cgit_querystring_cb(const char *name, const char *value); 67extern void cgit_querystring_cb(const char *name, const char *value);
68 68
69extern void *cgit_free_commitinfo(struct commitinfo *info); 69extern void *cgit_free_commitinfo(struct commitinfo *info);
70 70
71extern char *fmt(const char *format,...); 71extern char *fmt(const char *format,...);
72 72
73extern void html(const char *txt); 73extern void html(const char *txt);
74extern void htmlf(const char *format,...); 74extern void htmlf(const char *format,...);
75extern void html_txt(char *txt); 75extern void html_txt(char *txt);
76extern void html_ntxt(int len, char *txt);
76extern void html_attr(char *txt); 77extern void html_attr(char *txt);
77extern void html_link_open(char *url, char *title, char *class); 78extern void html_link_open(char *url, char *title, char *class);
78extern void html_link_close(void); 79extern void html_link_close(void);
79extern void html_filemode(unsigned short mode); 80extern void html_filemode(unsigned short mode);
80 81
81extern int cgit_read_config(const char *filename, configfn fn); 82extern int cgit_read_config(const char *filename, configfn fn);
82extern int cgit_parse_query(char *txt, configfn fn); 83extern int cgit_parse_query(char *txt, configfn fn);
83extern struct commitinfo *cgit_parse_commit(struct commit *commit); 84extern struct commitinfo *cgit_parse_commit(struct commit *commit);
84 85
85extern void cache_prepare(struct cacheitem *item); 86extern void cache_prepare(struct cacheitem *item);
86extern int cache_lock(struct cacheitem *item); 87extern int cache_lock(struct cacheitem *item);
87extern int cache_unlock(struct cacheitem *item); 88extern int cache_unlock(struct cacheitem *item);
88extern int cache_cancel_lock(struct cacheitem *item); 89extern int cache_cancel_lock(struct cacheitem *item);
89extern int cache_exist(struct cacheitem *item); 90extern int cache_exist(struct cacheitem *item);
90extern int cache_expired(struct cacheitem *item); 91extern int cache_expired(struct cacheitem *item);
91 92
92extern char *cgit_repourl(const char *reponame); 93extern char *cgit_repourl(const char *reponame);
93extern char *cgit_pageurl(const char *reponame, const char *pagename, 94extern char *cgit_pageurl(const char *reponame, const char *pagename,
94 const char *query); 95 const char *query);
95 96
96extern void cgit_print_error(char *msg); 97extern void cgit_print_error(char *msg);
97extern void cgit_print_date(unsigned long secs); 98extern void cgit_print_date(unsigned long secs);
98extern void cgit_print_docstart(char *title, struct cacheitem *item); 99extern void cgit_print_docstart(char *title, struct cacheitem *item);
99extern void cgit_print_docend(); 100extern void cgit_print_docend();
100extern void cgit_print_pageheader(char *title); 101extern void cgit_print_pageheader(char *title);
101 102
102extern void cgit_print_repolist(struct cacheitem *item); 103extern void cgit_print_repolist(struct cacheitem *item);
103extern void cgit_print_summary(); 104extern void cgit_print_summary();
104extern void cgit_print_log(const char *tip, int ofs, int cnt); 105extern void cgit_print_log(const char *tip, int ofs, int cnt);
105extern void cgit_print_view(const char *hex); 106extern void cgit_print_view(const char *hex);
106extern void cgit_print_tree(const char *hex); 107extern void cgit_print_tree(const char *hex);
107extern void cgit_print_commit(const char *hex); 108extern void cgit_print_commit(const char *hex);
108extern void cgit_print_diff(const char *old_hex, const char *new_hex); 109extern void cgit_print_diff(const char *old_hex, const char *new_hex);
109 110
110#endif /* CGIT_H */ 111#endif /* CGIT_H */
diff --git a/html.c b/html.c
index 8a69659..957b326 100644
--- a/html.c
+++ b/html.c
@@ -20,96 +20,124 @@ char *fmt(const char *format, ...)
20 20
21 va_start(args, format); 21 va_start(args, format);
22 len = vsnprintf(buf[bufidx], sizeof(buf[bufidx]), format, args); 22 len = vsnprintf(buf[bufidx], sizeof(buf[bufidx]), format, args);
23 va_end(args); 23 va_end(args);
24 if (len>sizeof(buf[bufidx])) 24 if (len>sizeof(buf[bufidx]))
25 die("[html.c] string truncated: %s", format); 25 die("[html.c] string truncated: %s", format);
26 return buf[bufidx]; 26 return buf[bufidx];
27} 27}
28 28
29void html(const char *txt) 29void html(const char *txt)
30{ 30{
31 write(htmlfd, txt, strlen(txt)); 31 write(htmlfd, txt, strlen(txt));
32} 32}
33 33
34void htmlf(const char *format, ...) 34void htmlf(const char *format, ...)
35{ 35{
36 static char buf[65536]; 36 static char buf[65536];
37 va_list args; 37 va_list args;
38 38
39 va_start(args, format); 39 va_start(args, format);
40 vsnprintf(buf, sizeof(buf), format, args); 40 vsnprintf(buf, sizeof(buf), format, args);
41 va_end(args); 41 va_end(args);
42 html(buf); 42 html(buf);
43} 43}
44 44
45void html_txt(char *txt) 45void html_txt(char *txt)
46{ 46{
47 char *t = txt; 47 char *t = txt;
48 while(*t){ 48 while(*t){
49 int c = *t; 49 int c = *t;
50 if (c=='<' || c=='>' || c=='&') { 50 if (c=='<' || c=='>' || c=='&') {
51 *t = '\0'; 51 *t = '\0';
52 html(txt); 52 html(txt);
53 *t = c; 53 *t = c;
54 if (c=='>') 54 if (c=='>')
55 html("&gt;"); 55 html("&gt;");
56 else if (c=='<') 56 else if (c=='<')
57 html("&lt;"); 57 html("&lt;");
58 else if (c=='&') 58 else if (c=='&')
59 html("&amp;"); 59 html("&amp;");
60 txt = t+1; 60 txt = t+1;
61 } 61 }
62 t++; 62 t++;
63 } 63 }
64 if (t!=txt) 64 if (t!=txt)
65 html(txt); 65 html(txt);
66} 66}
67 67
68void html_ntxt(int len, char *txt)
69{
70 char *t = txt;
71 while(*t && len--){
72 int c = *t;
73 if (c=='<' || c=='>' || c=='&') {
74 *t = '\0';
75 html(txt);
76 *t = c;
77 if (c=='>')
78 html("&gt;");
79 else if (c=='<')
80 html("&lt;");
81 else if (c=='&')
82 html("&amp;");
83 txt = t+1;
84 }
85 t++;
86 }
87 if (t!=txt) {
88 char c = *t;
89 *t = '\0';
90 html(txt);
91 *t = c;
92 }
93 if (len<0)
94 html("...");
95}
68 96
69void html_attr(char *txt) 97void html_attr(char *txt)
70{ 98{
71 char *t = txt; 99 char *t = txt;
72 while(*t){ 100 while(*t){
73 int c = *t; 101 int c = *t;
74 if (c=='<' || c=='>' || c=='\'') { 102 if (c=='<' || c=='>' || c=='\'') {
75 *t = '\0'; 103 *t = '\0';
76 html(txt); 104 html(txt);
77 *t = c; 105 *t = c;
78 if (c=='>') 106 if (c=='>')
79 html("&gt;"); 107 html("&gt;");
80 else if (c=='<') 108 else if (c=='<')
81 html("&lt;"); 109 html("&lt;");
82 else if (c=='\'') 110 else if (c=='\'')
83 html("&quote;"); 111 html("&quote;");
84 txt = t+1; 112 txt = t+1;
85 } 113 }
86 t++; 114 t++;
87 } 115 }
88 if (t!=txt) 116 if (t!=txt)
89 html(txt); 117 html(txt);
90} 118}
91 119
92void html_link_open(char *url, char *title, char *class) 120void html_link_open(char *url, char *title, char *class)
93{ 121{
94 html("<a href='"); 122 html("<a href='");
95 html_attr(url); 123 html_attr(url);
96 if (title) { 124 if (title) {
97 html("' title='"); 125 html("' title='");
98 html_attr(title); 126 html_attr(title);
99 } 127 }
100 if (class) { 128 if (class) {
101 html("' class='"); 129 html("' class='");
102 html_attr(class); 130 html_attr(class);
103 } 131 }
104 html("'>"); 132 html("'>");
105} 133}
106 134
107void html_link_close(void) 135void html_link_close(void)
108{ 136{
109 html("</a>"); 137 html("</a>");
110} 138}
111 139
112void html_fileperm(unsigned short mode) 140void html_fileperm(unsigned short mode)
113{ 141{
114 htmlf("%c%c%c", (mode & 4 ? 'r' : '-'), 142 htmlf("%c%c%c", (mode & 4 ? 'r' : '-'),
115 (mode & 2 ? 'w' : '-'), (mode & 1 ? 'x' : '-')); 143 (mode & 2 ? 'w' : '-'), (mode & 1 ? 'x' : '-'));
diff --git a/ui-log.c b/ui-log.c
index def96f6..f3b16e7 100644
--- a/ui-log.c
+++ b/ui-log.c
@@ -1,91 +1,91 @@
1/* ui-log.c: functions for log output 1/* ui-log.c: functions for log output
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
11void print_commit(struct commit *commit) 11void print_commit(struct commit *commit)
12{ 12{
13 char buf[32]; 13 char buf[32];
14 struct commitinfo *info; 14 struct commitinfo *info;
15 struct tm *time; 15 struct tm *time;
16 16
17 info = cgit_parse_commit(commit); 17 info = cgit_parse_commit(commit);
18 time = gmtime(&commit->date); 18 time = gmtime(&commit->date);
19 html("<tr><td>"); 19 html("<tr><td>");
20 strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S", time); 20 strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S", time);
21 html_txt(buf); 21 html_txt(buf);
22 html("</td><td>"); 22 html("</td><td>");
23 char *qry = fmt("id=%s", sha1_to_hex(commit->object.sha1)); 23 char *qry = fmt("id=%s", sha1_to_hex(commit->object.sha1));
24 char *url = cgit_pageurl(cgit_query_repo, "commit", qry); 24 char *url = cgit_pageurl(cgit_query_repo, "commit", qry);
25 html_link_open(url, NULL, NULL); 25 html_link_open(url, NULL, NULL);
26 html_txt(info->subject); 26 html_ntxt(80, info->subject);
27 html_link_close(); 27 html_link_close();
28 html("</td><td>"); 28 html("</td><td>");
29 html_txt(info->author); 29 html_txt(info->author);
30 html("</td></tr>\n"); 30 html("</td></tr>\n");
31 cgit_free_commitinfo(info); 31 cgit_free_commitinfo(info);
32} 32}
33 33
34 34
35void cgit_print_log(const char *tip, int ofs, int cnt) 35void cgit_print_log(const char *tip, int ofs, int cnt)
36{ 36{
37 struct rev_info rev; 37 struct rev_info rev;
38 struct commit *commit; 38 struct commit *commit;
39 const char *argv[2] = {NULL, tip}; 39 const char *argv[2] = {NULL, tip};
40 int i; 40 int i;
41 41
42 init_revisions(&rev, NULL); 42 init_revisions(&rev, NULL);
43 rev.abbrev = DEFAULT_ABBREV; 43 rev.abbrev = DEFAULT_ABBREV;
44 rev.commit_format = CMIT_FMT_DEFAULT; 44 rev.commit_format = CMIT_FMT_DEFAULT;
45 rev.verbose_header = 1; 45 rev.verbose_header = 1;
46 rev.show_root_diff = 0; 46 rev.show_root_diff = 0;
47 setup_revisions(2, argv, &rev, NULL); 47 setup_revisions(2, argv, &rev, NULL);
48 prepare_revision_walk(&rev); 48 prepare_revision_walk(&rev);
49 49
50 html("<h2>Log</h2>"); 50 html("<h2>Log</h2>");
51 html("<table class='list log'>"); 51 html("<table class='list nowrap'>");
52 html("<tr><th class='left'>Date</th>" 52 html("<tr><th class='left'>Date</th>"
53 "<th class='left'>Message</th>" 53 "<th class='left'>Message</th>"
54 "<th class='left'>Author</th></tr>\n"); 54 "<th class='left'>Author</th></tr>\n");
55 55
56 if (ofs<0) 56 if (ofs<0)
57 ofs = 0; 57 ofs = 0;
58 58
59 for (i = 0; i < ofs && (commit = get_revision(&rev)) != NULL; i++) { 59 for (i = 0; i < ofs && (commit = get_revision(&rev)) != NULL; i++) {
60 free(commit->buffer); 60 free(commit->buffer);
61 commit->buffer = NULL; 61 commit->buffer = NULL;
62 free_commit_list(commit->parents); 62 free_commit_list(commit->parents);
63 commit->parents = NULL; 63 commit->parents = NULL;
64 } 64 }
65 65
66 for (i = 0; i < cnt && (commit = get_revision(&rev)) != NULL; i++) { 66 for (i = 0; i < cnt && (commit = get_revision(&rev)) != NULL; i++) {
67 print_commit(commit); 67 print_commit(commit);
68 free(commit->buffer); 68 free(commit->buffer);
69 commit->buffer = NULL; 69 commit->buffer = NULL;
70 free_commit_list(commit->parents); 70 free_commit_list(commit->parents);
71 commit->parents = NULL; 71 commit->parents = NULL;
72 } 72 }
73 html("</table>\n"); 73 html("</table>\n");
74 74
75 html("<div class='pager'>"); 75 html("<div class='pager'>");
76 if (ofs > 0) { 76 if (ofs > 0) {
77 html("&nbsp;<a href='"); 77 html("&nbsp;<a href='");
78 html(cgit_pageurl(cgit_query_repo, cgit_query_page, 78 html(cgit_pageurl(cgit_query_repo, cgit_query_page,
79 fmt("h=%s&ofs=%d", tip, ofs-cnt))); 79 fmt("h=%s&ofs=%d", tip, ofs-cnt)));
80 html("'>[prev]</a>&nbsp;"); 80 html("'>[prev]</a>&nbsp;");
81 } 81 }
82 82
83 if ((commit = get_revision(&rev)) != NULL) { 83 if ((commit = get_revision(&rev)) != NULL) {
84 html("&nbsp;<a href='"); 84 html("&nbsp;<a href='");
85 html(cgit_pageurl(cgit_query_repo, "log", 85 html(cgit_pageurl(cgit_query_repo, "log",
86 fmt("h=%s&ofs=%d", tip, ofs+cnt))); 86 fmt("h=%s&ofs=%d", tip, ofs+cnt)));
87 html("'>[next]</a>&nbsp;"); 87 html("'>[next]</a>&nbsp;");
88 } 88 }
89 html("</div>"); 89 html("</div>");
90} 90}
91 91
diff --git a/ui-summary.c b/ui-summary.c
index 638c8f6..de95053 100644
--- a/ui-summary.c
+++ b/ui-summary.c
@@ -1,67 +1,67 @@
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 cgit_print_branch_cb(const char *refname, const unsigned char *sha1, 11static int cgit_print_branch_cb(const char *refname, const unsigned char *sha1,
12 int flags, void *cb_data) 12 int flags, void *cb_data)
13{ 13{
14 struct commit *commit; 14 struct commit *commit;
15 struct commitinfo *info; 15 struct commitinfo *info;
16 char buf[256], *url; 16 char buf[256], *url;
17 17
18 commit = lookup_commit(sha1); 18 commit = lookup_commit(sha1);
19 if (commit && !parse_commit(commit)){ 19 if (commit && !parse_commit(commit)){
20 info = cgit_parse_commit(commit); 20 info = cgit_parse_commit(commit);
21 html("<tr><td>"); 21 html("<tr><td>");
22 url = cgit_pageurl(cgit_query_repo, "log", 22 url = cgit_pageurl(cgit_query_repo, "log",
23 fmt("h=%s", refname)); 23 fmt("h=%s", refname));
24 html_link_open(url, NULL, NULL); 24 html_link_open(url, NULL, NULL);
25 strncpy(buf, refname, sizeof(buf)); 25 strncpy(buf, refname, sizeof(buf));
26 html_txt(buf); 26 html_txt(buf);
27 html_link_close(); 27 html_link_close();
28 html("</td><td>"); 28 html("</td><td>");
29 cgit_print_date(commit->date); 29 cgit_print_date(commit->date);
30 html("</td><td>"); 30 html("</td><td>");
31 url = cgit_pageurl(cgit_query_repo, "commit", 31 url = cgit_pageurl(cgit_query_repo, "commit",
32 fmt("id=%s", sha1_to_hex(sha1))); 32 fmt("id=%s", sha1_to_hex(sha1)));
33 html_link_open(url, NULL, NULL); 33 html_link_open(url, NULL, NULL);
34 html_txt(info->subject); 34 html_ntxt(80, info->subject);
35 html_link_close(); 35 html_link_close();
36 html("</td><td>"); 36 html("</td><td>");
37 html_txt(info->author); 37 html_txt(info->author);
38 html("</td></tr>\n"); 38 html("</td></tr>\n");
39 cgit_free_commitinfo(info); 39 cgit_free_commitinfo(info);
40 } else { 40 } else {
41 html("<tr><td>"); 41 html("<tr><td>");
42 html_txt(buf); 42 html_txt(buf);
43 html("</td><td>"); 43 html("</td><td>");
44 htmlf("*** bad ref %s", sha1_to_hex(sha1)); 44 htmlf("*** bad ref %s", sha1_to_hex(sha1));
45 html("</td></tr>\n"); 45 html("</td></tr>\n");
46 } 46 }
47 return 0; 47 return 0;
48} 48}
49 49
50static void cgit_print_branches() 50static void cgit_print_branches()
51{ 51{
52 html("<table class='list'>"); 52 html("<table class='list nowrap'>");
53 html("<tr><th class='left'>Branch</th>" 53 html("<tr><th class='left'>Branch</th>"
54 "<th class='left'>Updated</th>" 54 "<th class='left'>Updated</th>"
55 "<th class='left'>Commit subject</th>" 55 "<th class='left'>Commit subject</th>"
56 "<th class='left'>Author</th></tr>\n"); 56 "<th class='left'>Author</th></tr>\n");
57 for_each_branch_ref(cgit_print_branch_cb, NULL); 57 for_each_branch_ref(cgit_print_branch_cb, NULL);
58 html("</table>"); 58 html("</table>");
59} 59}
60 60
61void cgit_print_summary() 61void cgit_print_summary()
62{ 62{
63 html("<h2>"); 63 html("<h2>");
64 html_txt("Repo summary page"); 64 html_txt("Repo summary page");
65 html("</h2>"); 65 html("</h2>");
66 cgit_print_branches(); 66 cgit_print_branches();
67} 67}