summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--cgit.c10
-rw-r--r--cgit.css23
-rw-r--r--cgit.h4
-rw-r--r--cgitrc4
-rw-r--r--parsing.c2
-rw-r--r--shared.c27
-rw-r--r--ui-log.c16
-rw-r--r--ui-repolist.c35
-rw-r--r--ui-shared.c71
-rw-r--r--ui-summary.c2
-rw-r--r--ui-tree.c4
11 files changed, 145 insertions, 53 deletions
diff --git a/cgit.c b/cgit.c
index 11dff76..d9a03c2 100644
--- a/cgit.c
+++ b/cgit.c
@@ -13,39 +13,41 @@ static int cgit_prepare_cache(struct cacheitem *item)
13 if (!cgit_repo && cgit_query_repo) { 13 if (!cgit_repo && cgit_query_repo) {
14 char *title = fmt("%s - %s", cgit_root_title, "Bad request"); 14 char *title = fmt("%s - %s", cgit_root_title, "Bad request");
15 cgit_print_docstart(title, item); 15 cgit_print_docstart(title, item);
16 cgit_print_pageheader(title, 0); 16 cgit_print_pageheader(title, 0);
17 cgit_print_error(fmt("Unknown repo: %s", cgit_query_repo)); 17 cgit_print_error(fmt("Unknown repo: %s", cgit_query_repo));
18 cgit_print_docend(); 18 cgit_print_docend();
19 return 0; 19 return 0;
20 } 20 }
21 21
22 if (!cgit_repo) { 22 if (!cgit_repo) {
23 item->name = xstrdup(fmt("%s/index.html", cgit_cache_root)); 23 item->name = xstrdup(fmt("%s/index.html", cgit_cache_root));
24 item->ttl = cgit_cache_root_ttl; 24 item->ttl = cgit_cache_root_ttl;
25 return 1; 25 return 1;
26 } 26 }
27 27
28 if (!cgit_cmd) { 28 if (!cgit_cmd) {
29 item->name = xstrdup(fmt("%s/%s/index.html", cgit_cache_root, 29 item->name = xstrdup(fmt("%s/%s/index.%s.html", cgit_cache_root,
30 cache_safe_filename(cgit_repo->url))); 30 cache_safe_filename(cgit_repo->url),
31 cache_safe_filename(cgit_querystring)));
31 item->ttl = cgit_cache_repo_ttl; 32 item->ttl = cgit_cache_repo_ttl;
32 } else { 33 } else {
33 item->name = xstrdup(fmt("%s/%s/%s/%s.html", cgit_cache_root, 34 item->name = xstrdup(fmt("%s/%s/%s/%s.html", cgit_cache_root,
34 cache_safe_filename(cgit_repo->url), cgit_query_page, 35 cache_safe_filename(cgit_repo->url),
35 cache_safe_filename(cgit_querystring))); 36 cgit_query_page,
37 cache_safe_filename(cgit_querystring)));
36 if (cgit_query_has_symref) 38 if (cgit_query_has_symref)
37 item->ttl = cgit_cache_dynamic_ttl; 39 item->ttl = cgit_cache_dynamic_ttl;
38 else if (cgit_query_has_sha1) 40 else if (cgit_query_has_sha1)
39 item->ttl = cgit_cache_static_ttl; 41 item->ttl = cgit_cache_static_ttl;
40 else 42 else
41 item->ttl = cgit_cache_repo_ttl; 43 item->ttl = cgit_cache_repo_ttl;
42 } 44 }
43 return 1; 45 return 1;
44} 46}
45 47
46static void cgit_print_repo_page(struct cacheitem *item) 48static void cgit_print_repo_page(struct cacheitem *item)
47{ 49{
48 char *title; 50 char *title;
49 int show_search; 51 int show_search;
50 52
51 if (!cgit_query_head) 53 if (!cgit_query_head)
diff --git a/cgit.css b/cgit.css
index cda437e..112dac1 100644
--- a/cgit.css
+++ b/cgit.css
@@ -82,58 +82,68 @@ table#layout {
82 margin: 0px; 82 margin: 0px;
83} 83}
84 84
85td#header, td#logo { 85td#header, td#logo {
86 color: #666; 86 color: #666;
87 background-color: #ddd; 87 background-color: #ddd;
88 border-bottom: solid 1px #000; 88 border-bottom: solid 1px #000;
89} 89}
90 90
91td#header { 91td#header {
92 font-size: 150%; 92 font-size: 150%;
93 font-weight: bold; 93 font-weight: bold;
94 padding: 0.2em 0.5em; 94 padding: 0.2em 0.5em;
95 vertical-align: text-bottom; 95 vertical-align: text-bottom;
96} 96}
97 97
98td#header a {
99 color: #666;
100}
101
102td#header a:hoved {
103 text-decoration: underline;
104}
105
98td#logo { 106td#logo {
99 text-align: right; 107 text-align: right;
100 vertical-align: middle; 108 vertical-align: middle;
101 padding-right: 0.5em; 109 padding-right: 0.5em;
102} 110}
103 111
104td#crumb, td#search { 112td#crumb, td#search {
105 color: #ccc; 113 color: #ccc;
106 border-top: solid 3px #555; 114 border-top: solid 3px #555;
107 background-color: #666; 115 background-color: #666;
108 border-bottom: solid 1px #333; 116 border-bottom: solid 1px #333;
109 padding: 2px 1em; 117 padding: 2px 1em;
110} 118}
111 119
112td#crumb { 120td#crumb {
113 font-weight: bold; 121 font-weight: bold;
114} 122}
115 123
116td#crumb a { 124td#crumb a {
117 color: #ccc; 125 color: #ccc;
118 background-color: #666; 126 background-color: #666;
127 padding: 0em 0.5em 0em 0.5em;
119} 128}
120 129
121td#crumb a:hover { 130td#crumb a:hover {
122 color: #eee; 131 color: #666;
123 background-color: #666; 132 background-color: #ccc;
133 text-decoration: none;
124} 134}
125 135
126td#search { 136td#search {
127 text-align: right; 137 text-align: right;
128 vertical-align: middle; 138 vertical-align: middle;
129 padding-right: 0.5em; 139 padding-right: 0.5em;
130} 140}
131 141
132td#search form { 142td#search form {
133 margin: 0px; 143 margin: 0px;
134 padding: 0px; 144 padding: 0px;
135} 145}
136 146
137td#search input { 147td#search input {
138 font-size: 9pt; 148 font-size: 9pt;
139 padding: 0px; 149 padding: 0px;
@@ -348,42 +358,43 @@ table.diff td div.del {
348 358
349.left { 359.left {
350 text-align: left; 360 text-align: left;
351} 361}
352 362
353.right { 363.right {
354 text-align: right; 364 text-align: right;
355} 365}
356 366
357table.list td.repogroup { 367table.list td.repogroup {
358 font-style: italic; 368 font-style: italic;
359 color: #888; 369 color: #888;
360} 370}
361 371
362a.button { 372a.button {
363 font-size: 80%; 373 font-size: 80%;
364 color: #333; 374 color: #aaa;
365 background-color: #ccc; 375 background-color: #eee;
366 border: solid 1px #999; 376 border: solid 1px #aaa;
367 padding: 0em 0.5em; 377 padding: 0em 0.5em;
368 margin: 0.1em 0.25em; 378 margin: 0.1em 0.25em;
369} 379}
370 380
371a.button:hover { 381a.button:hover {
372 text-decoration: none; 382 text-decoration: none;
373 background-color: #eee; 383 color: #333;
384 background-color: #ccc;
374} 385}
375 386
376a.primary { 387a.primary {
377 font-size: 100%; 388 font-size: 100%;
378} 389}
379 390
380a.secondary { 391a.secondary {
381 font-size: 90%; 392 font-size: 90%;
382} 393}
383 394
384td.toplevel-repo { 395td.toplevel-repo {
385 396
386} 397}
387 398
388table.list td.sublevel-repo { 399table.list td.sublevel-repo {
389 padding-left: 1.5em; 400 padding-left: 1.5em;
diff --git a/cgit.h b/cgit.h
index 9558362..2ff5340 100644
--- a/cgit.h
+++ b/cgit.h
@@ -105,32 +105,33 @@ extern struct repoinfo *cgit_repo;
105extern int cgit_cmd; 105extern int cgit_cmd;
106 106
107extern char *cgit_root_title; 107extern char *cgit_root_title;
108extern char *cgit_css; 108extern char *cgit_css;
109extern char *cgit_logo; 109extern char *cgit_logo;
110extern char *cgit_index_header; 110extern char *cgit_index_header;
111extern char *cgit_logo_link; 111extern char *cgit_logo_link;
112extern char *cgit_module_link; 112extern char *cgit_module_link;
113extern char *cgit_agefile; 113extern char *cgit_agefile;
114extern char *cgit_virtual_root; 114extern char *cgit_virtual_root;
115extern char *cgit_script_name; 115extern char *cgit_script_name;
116extern char *cgit_cache_root; 116extern char *cgit_cache_root;
117extern char *cgit_repo_group; 117extern char *cgit_repo_group;
118 118
119extern int cgit_nocache; 119extern int cgit_nocache;
120extern int cgit_snapshots; 120extern int cgit_snapshots;
121extern int cgit_enable_index_links;
121extern int cgit_enable_log_filecount; 122extern int cgit_enable_log_filecount;
122extern int cgit_enable_log_linecount; 123extern int cgit_enable_log_linecount;
123extern int cgit_max_lock_attempts; 124extern int cgit_max_lock_attempts;
124extern int cgit_cache_root_ttl; 125extern int cgit_cache_root_ttl;
125extern int cgit_cache_repo_ttl; 126extern int cgit_cache_repo_ttl;
126extern int cgit_cache_dynamic_ttl; 127extern int cgit_cache_dynamic_ttl;
127extern int cgit_cache_static_ttl; 128extern int cgit_cache_static_ttl;
128extern int cgit_cache_max_create_time; 129extern int cgit_cache_max_create_time;
129extern int cgit_summary_log; 130extern int cgit_summary_log;
130 131
131extern int cgit_max_msg_len; 132extern int cgit_max_msg_len;
132extern int cgit_max_repodesc_len; 133extern int cgit_max_repodesc_len;
133extern int cgit_max_commit_count; 134extern int cgit_max_commit_count;
134 135
135extern int cgit_query_has_symref; 136extern int cgit_query_has_symref;
136extern int cgit_query_has_sha1; 137extern int cgit_query_has_sha1;
@@ -145,32 +146,33 @@ extern char *cgit_query_sha2;
145extern char *cgit_query_path; 146extern char *cgit_query_path;
146extern char *cgit_query_name; 147extern char *cgit_query_name;
147extern int cgit_query_ofs; 148extern int cgit_query_ofs;
148 149
149extern int htmlfd; 150extern int htmlfd;
150 151
151extern int cgit_get_cmd_index(const char *cmd); 152extern int cgit_get_cmd_index(const char *cmd);
152extern struct repoinfo *cgit_get_repoinfo(const char *url); 153extern struct repoinfo *cgit_get_repoinfo(const char *url);
153extern void cgit_global_config_cb(const char *name, const char *value); 154extern void cgit_global_config_cb(const char *name, const char *value);
154extern void cgit_repo_config_cb(const char *name, const char *value); 155extern void cgit_repo_config_cb(const char *name, const char *value);
155extern void cgit_querystring_cb(const char *name, const char *value); 156extern void cgit_querystring_cb(const char *name, const char *value);
156 157
157extern int chk_zero(int result, char *msg); 158extern int chk_zero(int result, char *msg);
158extern int chk_positive(int result, char *msg); 159extern int chk_positive(int result, char *msg);
159 160
160extern int hextoint(char c); 161extern int hextoint(char c);
162extern char *trim_end(const char *str, char c);
161 163
162extern void *cgit_free_commitinfo(struct commitinfo *info); 164extern void *cgit_free_commitinfo(struct commitinfo *info);
163 165
164extern int cgit_diff_files(const unsigned char *old_sha1, 166extern int cgit_diff_files(const unsigned char *old_sha1,
165 const unsigned char *new_sha1, 167 const unsigned char *new_sha1,
166 linediff_fn fn); 168 linediff_fn fn);
167 169
168extern void cgit_diff_tree(const unsigned char *old_sha1, 170extern void cgit_diff_tree(const unsigned char *old_sha1,
169 const unsigned char *new_sha1, 171 const unsigned char *new_sha1,
170 filepair_fn fn); 172 filepair_fn fn);
171 173
172extern void cgit_diff_commit(struct commit *commit, filepair_fn fn); 174extern void cgit_diff_commit(struct commit *commit, filepair_fn fn);
173 175
174extern char *fmt(const char *format,...); 176extern char *fmt(const char *format,...);
175 177
176extern void html(const char *txt); 178extern void html(const char *txt);
@@ -191,33 +193,33 @@ extern struct taginfo *cgit_parse_tag(struct tag *tag);
191extern void cgit_parse_url(const char *url); 193extern void cgit_parse_url(const char *url);
192 194
193extern char *cache_safe_filename(const char *unsafe); 195extern char *cache_safe_filename(const char *unsafe);
194extern int cache_lock(struct cacheitem *item); 196extern int cache_lock(struct cacheitem *item);
195extern int cache_unlock(struct cacheitem *item); 197extern int cache_unlock(struct cacheitem *item);
196extern int cache_cancel_lock(struct cacheitem *item); 198extern int cache_cancel_lock(struct cacheitem *item);
197extern int cache_exist(struct cacheitem *item); 199extern int cache_exist(struct cacheitem *item);
198extern int cache_expired(struct cacheitem *item); 200extern int cache_expired(struct cacheitem *item);
199 201
200extern char *cgit_repourl(const char *reponame); 202extern char *cgit_repourl(const char *reponame);
201extern char *cgit_pageurl(const char *reponame, const char *pagename, 203extern char *cgit_pageurl(const char *reponame, const char *pagename,
202 const char *query); 204 const char *query);
203 205
204extern void cgit_tree_link(char *name, char *title, char *class, char *head, 206extern void cgit_tree_link(char *name, char *title, char *class, char *head,
205 char *rev, char *path); 207 char *rev, char *path);
206extern void cgit_log_link(char *name, char *title, char *class, char *head, 208extern void cgit_log_link(char *name, char *title, char *class, char *head,
207 char *rev, char *path); 209 char *rev, char *path, int ofs);
208extern void cgit_commit_link(char *name, char *title, char *class, char *head, 210extern void cgit_commit_link(char *name, char *title, char *class, char *head,
209 char *rev); 211 char *rev);
210extern void cgit_diff_link(char *name, char *title, char *class, char *head, 212extern void cgit_diff_link(char *name, char *title, char *class, char *head,
211 char *new_rev, char *old_rev, char *path); 213 char *new_rev, char *old_rev, char *path);
212 214
213extern void cgit_print_error(char *msg); 215extern void cgit_print_error(char *msg);
214extern void cgit_print_date(time_t secs, char *format); 216extern void cgit_print_date(time_t secs, char *format);
215extern void cgit_print_age(time_t t, time_t max_relative, char *format); 217extern void cgit_print_age(time_t t, time_t max_relative, char *format);
216extern void cgit_print_docstart(char *title, struct cacheitem *item); 218extern void cgit_print_docstart(char *title, struct cacheitem *item);
217extern void cgit_print_docend(); 219extern void cgit_print_docend();
218extern void cgit_print_pageheader(char *title, int show_search); 220extern void cgit_print_pageheader(char *title, int show_search);
219extern void cgit_print_snapshot_start(const char *mimetype, 221extern void cgit_print_snapshot_start(const char *mimetype,
220 const char *filename, 222 const char *filename,
221 struct cacheitem *item); 223 struct cacheitem *item);
222 224
223extern void cgit_print_repolist(struct cacheitem *item); 225extern void cgit_print_repolist(struct cacheitem *item);
diff --git a/cgitrc b/cgitrc
index 0f602e4..40877f8 100644
--- a/cgitrc
+++ b/cgitrc
@@ -1,30 +1,34 @@
1## 1##
2## cgitrc: template for /etc/cgitrc 2## cgitrc: template for /etc/cgitrc
3## 3##
4 4
5 5
6## Uncomment and set to 1 to deactivate caching of generated pages. Mostly 6## Uncomment and set to 1 to deactivate caching of generated pages. Mostly
7## usefull for testing. 7## usefull for testing.
8#nocache=0 8#nocache=0
9 9
10 10
11## Enable/disable snapshots by default. This can be overridden per repo 11## Enable/disable snapshots by default. This can be overridden per repo
12#snapshots=0 12#snapshots=0
13 13
14 14
15## Enable/disable extra links to summary/log/tree per repo on index page
16#enable-index-links=0
17
18
15## Enable/disable display of 'number of files changed' in log view 19## Enable/disable display of 'number of files changed' in log view
16#enable-log-filecount=0 20#enable-log-filecount=0
17 21
18 22
19## Enable/disable display of 'number of lines changed' in log view 23## Enable/disable display of 'number of lines changed' in log view
20#enable-log-linecount=0 24#enable-log-linecount=0
21 25
22 26
23## Enable/disable display of HEAD shortlog in summary view. Set it to maximum 27## Enable/disable display of HEAD shortlog in summary view. Set it to maximum
24## number of commits that should be displayed 28## number of commits that should be displayed
25#summary-log=0 29#summary-log=0
26 30
27 31
28## Specify a root for virtual urls. This makes cgit generate urls like 32## Specify a root for virtual urls. This makes cgit generate urls like
29## 33##
30## http://localhost/git/repo/log/?id=master 34## http://localhost/git/repo/log/?id=master
diff --git a/parsing.c b/parsing.c
index 74a2484..2c05c09 100644
--- a/parsing.c
+++ b/parsing.c
@@ -155,33 +155,33 @@ void cgit_parse_url(const char *url)
155 155
156 cmd = strchr(url, '/'); 156 cmd = strchr(url, '/');
157 while (!cgit_repo && cmd) { 157 while (!cgit_repo && cmd) {
158 cmd[0] = '\0'; 158 cmd[0] = '\0';
159 cgit_repo = cgit_get_repoinfo(url); 159 cgit_repo = cgit_get_repoinfo(url);
160 if (cgit_repo == NULL) { 160 if (cgit_repo == NULL) {
161 cmd[0] = '/'; 161 cmd[0] = '/';
162 cmd = strchr(cmd + 1, '/'); 162 cmd = strchr(cmd + 1, '/');
163 continue; 163 continue;
164 } 164 }
165 165
166 cgit_query_repo = cgit_repo->url; 166 cgit_query_repo = cgit_repo->url;
167 p = strchr(cmd + 1, '/'); 167 p = strchr(cmd + 1, '/');
168 if (p) { 168 if (p) {
169 p[0] = '\0'; 169 p[0] = '\0';
170 if (p[1]) 170 if (p[1])
171 cgit_query_path = xstrdup(p + 1); 171 cgit_query_path = trim_end(p + 1, '/');
172 } 172 }
173 cgit_cmd = cgit_get_cmd_index(cmd + 1); 173 cgit_cmd = cgit_get_cmd_index(cmd + 1);
174 cgit_query_page = xstrdup(cmd + 1); 174 cgit_query_page = xstrdup(cmd + 1);
175 return; 175 return;
176 } 176 }
177} 177}
178 178
179char *substr(const char *head, const char *tail) 179char *substr(const char *head, const char *tail)
180{ 180{
181 char *buf; 181 char *buf;
182 182
183 buf = xmalloc(tail - head + 1); 183 buf = xmalloc(tail - head + 1);
184 strncpy(buf, head, tail - head); 184 strncpy(buf, head, tail - head);
185 buf[tail - head] = '\0'; 185 buf[tail - head] = '\0';
186 return buf; 186 return buf;
187} 187}
diff --git a/shared.c b/shared.c
index f7f43b2..1a5b866 100644
--- a/shared.c
+++ b/shared.c
@@ -15,32 +15,33 @@ int cgit_cmd;
15const char *cgit_version = CGIT_VERSION; 15const char *cgit_version = CGIT_VERSION;
16 16
17char *cgit_root_title = "Git repository browser"; 17char *cgit_root_title = "Git repository browser";
18char *cgit_css = "/cgit.css"; 18char *cgit_css = "/cgit.css";
19char *cgit_logo = "/git-logo.png"; 19char *cgit_logo = "/git-logo.png";
20char *cgit_index_header = NULL; 20char *cgit_index_header = NULL;
21char *cgit_logo_link = "http://www.kernel.org/pub/software/scm/git/docs/"; 21char *cgit_logo_link = "http://www.kernel.org/pub/software/scm/git/docs/";
22char *cgit_module_link = "./?repo=%s&page=commit&id=%s"; 22char *cgit_module_link = "./?repo=%s&page=commit&id=%s";
23char *cgit_agefile = "info/web/last-modified"; 23char *cgit_agefile = "info/web/last-modified";
24char *cgit_virtual_root = NULL; 24char *cgit_virtual_root = NULL;
25char *cgit_script_name = CGIT_SCRIPT_NAME; 25char *cgit_script_name = CGIT_SCRIPT_NAME;
26char *cgit_cache_root = "/var/cache/cgit"; 26char *cgit_cache_root = "/var/cache/cgit";
27char *cgit_repo_group = NULL; 27char *cgit_repo_group = NULL;
28 28
29int cgit_nocache = 0; 29int cgit_nocache = 0;
30int cgit_snapshots = 0; 30int cgit_snapshots = 0;
31int cgit_enable_index_links = 0;
31int cgit_enable_log_filecount = 0; 32int cgit_enable_log_filecount = 0;
32int cgit_enable_log_linecount = 0; 33int cgit_enable_log_linecount = 0;
33int cgit_max_lock_attempts = 5; 34int cgit_max_lock_attempts = 5;
34int cgit_cache_root_ttl = 5; 35int cgit_cache_root_ttl = 5;
35int cgit_cache_repo_ttl = 5; 36int cgit_cache_repo_ttl = 5;
36int cgit_cache_dynamic_ttl = 5; 37int cgit_cache_dynamic_ttl = 5;
37int cgit_cache_static_ttl = -1; 38int cgit_cache_static_ttl = -1;
38int cgit_cache_max_create_time = 5; 39int cgit_cache_max_create_time = 5;
39int cgit_summary_log = 0; 40int cgit_summary_log = 0;
40 41
41int cgit_max_msg_len = 60; 42int cgit_max_msg_len = 60;
42int cgit_max_repodesc_len = 60; 43int cgit_max_repodesc_len = 60;
43int cgit_max_commit_count = 50; 44int cgit_max_commit_count = 50;
44 45
45int cgit_query_has_symref = 0; 46int cgit_query_has_symref = 0;
46int cgit_query_has_sha1 = 0; 47int cgit_query_has_sha1 = 0;
@@ -135,32 +136,34 @@ void cgit_global_config_cb(const char *name, const char *value)
135 else if (!strcmp(name, "css")) 136 else if (!strcmp(name, "css"))
136 cgit_css = xstrdup(value); 137 cgit_css = xstrdup(value);
137 else if (!strcmp(name, "logo")) 138 else if (!strcmp(name, "logo"))
138 cgit_logo = xstrdup(value); 139 cgit_logo = xstrdup(value);
139 else if (!strcmp(name, "index-header")) 140 else if (!strcmp(name, "index-header"))
140 cgit_index_header = xstrdup(value); 141 cgit_index_header = xstrdup(value);
141 else if (!strcmp(name, "logo-link")) 142 else if (!strcmp(name, "logo-link"))
142 cgit_logo_link = xstrdup(value); 143 cgit_logo_link = xstrdup(value);
143 else if (!strcmp(name, "module-link")) 144 else if (!strcmp(name, "module-link"))
144 cgit_module_link = xstrdup(value); 145 cgit_module_link = xstrdup(value);
145 else if (!strcmp(name, "virtual-root")) 146 else if (!strcmp(name, "virtual-root"))
146 cgit_virtual_root = xstrdup(value); 147 cgit_virtual_root = xstrdup(value);
147 else if (!strcmp(name, "nocache")) 148 else if (!strcmp(name, "nocache"))
148 cgit_nocache = atoi(value); 149 cgit_nocache = atoi(value);
149 else if (!strcmp(name, "snapshots")) 150 else if (!strcmp(name, "snapshots"))
150 cgit_snapshots = atoi(value); 151 cgit_snapshots = atoi(value);
152 else if (!strcmp(name, "enable-index-links"))
153 cgit_enable_index_links = atoi(value);
151 else if (!strcmp(name, "enable-log-filecount")) 154 else if (!strcmp(name, "enable-log-filecount"))
152 cgit_enable_log_filecount = atoi(value); 155 cgit_enable_log_filecount = atoi(value);
153 else if (!strcmp(name, "enable-log-linecount")) 156 else if (!strcmp(name, "enable-log-linecount"))
154 cgit_enable_log_linecount = atoi(value); 157 cgit_enable_log_linecount = atoi(value);
155 else if (!strcmp(name, "cache-root")) 158 else if (!strcmp(name, "cache-root"))
156 cgit_cache_root = xstrdup(value); 159 cgit_cache_root = xstrdup(value);
157 else if (!strcmp(name, "cache-root-ttl")) 160 else if (!strcmp(name, "cache-root-ttl"))
158 cgit_cache_root_ttl = atoi(value); 161 cgit_cache_root_ttl = atoi(value);
159 else if (!strcmp(name, "cache-repo-ttl")) 162 else if (!strcmp(name, "cache-repo-ttl"))
160 cgit_cache_repo_ttl = atoi(value); 163 cgit_cache_repo_ttl = atoi(value);
161 else if (!strcmp(name, "cache-static-ttl")) 164 else if (!strcmp(name, "cache-static-ttl"))
162 cgit_cache_static_ttl = atoi(value); 165 cgit_cache_static_ttl = atoi(value);
163 else if (!strcmp(name, "cache-dynamic-ttl")) 166 else if (!strcmp(name, "cache-dynamic-ttl"))
164 cgit_cache_dynamic_ttl = atoi(value); 167 cgit_cache_dynamic_ttl = atoi(value);
165 else if (!strcmp(name, "max-message-length")) 168 else if (!strcmp(name, "max-message-length"))
166 cgit_max_msg_len = atoi(value); 169 cgit_max_msg_len = atoi(value);
@@ -214,61 +217,83 @@ void cgit_querystring_cb(const char *name, const char *value)
214 } else if (!strcmp(name, "url")) { 217 } else if (!strcmp(name, "url")) {
215 cgit_parse_url(value); 218 cgit_parse_url(value);
216 } else if (!strcmp(name, "q")) { 219 } else if (!strcmp(name, "q")) {
217 cgit_query_search = xstrdup(value); 220 cgit_query_search = xstrdup(value);
218 } else if (!strcmp(name, "h")) { 221 } else if (!strcmp(name, "h")) {
219 cgit_query_head = xstrdup(value); 222 cgit_query_head = xstrdup(value);
220 cgit_query_has_symref = 1; 223 cgit_query_has_symref = 1;
221 } else if (!strcmp(name, "id")) { 224 } else if (!strcmp(name, "id")) {
222 cgit_query_sha1 = xstrdup(value); 225 cgit_query_sha1 = xstrdup(value);
223 cgit_query_has_sha1 = 1; 226 cgit_query_has_sha1 = 1;
224 } else if (!strcmp(name, "id2")) { 227 } else if (!strcmp(name, "id2")) {
225 cgit_query_sha2 = xstrdup(value); 228 cgit_query_sha2 = xstrdup(value);
226 cgit_query_has_sha1 = 1; 229 cgit_query_has_sha1 = 1;
227 } else if (!strcmp(name, "ofs")) { 230 } else if (!strcmp(name, "ofs")) {
228 cgit_query_ofs = atoi(value); 231 cgit_query_ofs = atoi(value);
229 } else if (!strcmp(name, "path")) { 232 } else if (!strcmp(name, "path")) {
230 cgit_query_path = xstrdup(value); 233 cgit_query_path = trim_end(value, '/');
231 } else if (!strcmp(name, "name")) { 234 } else if (!strcmp(name, "name")) {
232 cgit_query_name = xstrdup(value); 235 cgit_query_name = xstrdup(value);
233 } 236 }
234} 237}
235 238
236void *cgit_free_commitinfo(struct commitinfo *info) 239void *cgit_free_commitinfo(struct commitinfo *info)
237{ 240{
238 free(info->author); 241 free(info->author);
239 free(info->author_email); 242 free(info->author_email);
240 free(info->committer); 243 free(info->committer);
241 free(info->committer_email); 244 free(info->committer_email);
242 free(info->subject); 245 free(info->subject);
243 free(info); 246 free(info);
244 return NULL; 247 return NULL;
245} 248}
246 249
247int hextoint(char c) 250int hextoint(char c)
248{ 251{
249 if (c >= 'a' && c <= 'f') 252 if (c >= 'a' && c <= 'f')
250 return 10 + c - 'a'; 253 return 10 + c - 'a';
251 else if (c >= 'A' && c <= 'F') 254 else if (c >= 'A' && c <= 'F')
252 return 10 + c - 'A'; 255 return 10 + c - 'A';
253 else if (c >= '0' && c <= '9') 256 else if (c >= '0' && c <= '9')
254 return c - '0'; 257 return c - '0';
255 else 258 else
256 return -1; 259 return -1;
257} 260}
258 261
262char *trim_end(const char *str, char c)
263{
264 int len;
265 char *s, *t;
266
267 if (str == NULL)
268 return NULL;
269 t = (char *)str;
270 len = strlen(t);
271 while(len > 0 && t[len - 1] == c)
272 len--;
273
274 if (len == 0)
275 return NULL;
276
277 c = t[len];
278 t[len] = '\0';
279 s = xstrdup(t);
280 t[len] = c;
281 return s;
282}
283
259void cgit_diff_tree_cb(struct diff_queue_struct *q, 284void cgit_diff_tree_cb(struct diff_queue_struct *q,
260 struct diff_options *options, void *data) 285 struct diff_options *options, void *data)
261{ 286{
262 int i; 287 int i;
263 288
264 for (i = 0; i < q->nr; i++) { 289 for (i = 0; i < q->nr; i++) {
265 if (q->queue[i]->status == 'U') 290 if (q->queue[i]->status == 'U')
266 continue; 291 continue;
267 ((filepair_fn)data)(q->queue[i]); 292 ((filepair_fn)data)(q->queue[i]);
268 } 293 }
269} 294}
270 295
271static int load_mmfile(mmfile_t *file, const unsigned char *sha1) 296static int load_mmfile(mmfile_t *file, const unsigned char *sha1)
272{ 297{
273 enum object_type type; 298 enum object_type type;
274 299
diff --git a/ui-log.c b/ui-log.c
index 95cb453..d38e40a 100644
--- a/ui-log.c
+++ b/ui-log.c
@@ -100,31 +100,29 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *path, i
100 free_commit_list(commit->parents); 100 free_commit_list(commit->parents);
101 commit->parents = NULL; 101 commit->parents = NULL;
102 } 102 }
103 103
104 for (i = 0; i < cnt && (commit = get_revision(&rev)) != NULL; i++) { 104 for (i = 0; i < cnt && (commit = get_revision(&rev)) != NULL; i++) {
105 print_commit(commit); 105 print_commit(commit);
106 free(commit->buffer); 106 free(commit->buffer);
107 commit->buffer = NULL; 107 commit->buffer = NULL;
108 free_commit_list(commit->parents); 108 free_commit_list(commit->parents);
109 commit->parents = NULL; 109 commit->parents = NULL;
110 } 110 }
111 html("</table>\n"); 111 html("</table>\n");
112 112
113 if (pager) { 113 if (pager) {
114 html("<div class='pager'>"); 114 html("<div class='pager'>");
115 if (ofs > 0) { 115 if (ofs > 0) {
116 html("&nbsp;<a href='"); 116 cgit_log_link("[prev]", NULL, NULL, cgit_query_head,
117 html(cgit_pageurl(cgit_query_repo, cgit_query_page, 117 cgit_query_sha1, cgit_query_path,
118 fmt("h=%s&amp;ofs=%d", tip, ofs-cnt))); 118 ofs - cnt);
119 html("'>[prev]</a>&nbsp;"); 119 html("&nbsp;");
120 } 120 }
121
122 if ((commit = get_revision(&rev)) != NULL) { 121 if ((commit = get_revision(&rev)) != NULL) {
123 html("&nbsp;<a href='"); 122 cgit_log_link("[next]", NULL, NULL, cgit_query_head,
124 html(cgit_pageurl(cgit_query_repo, "log", 123 cgit_query_sha1, cgit_query_path,
125 fmt("h=%s&amp;ofs=%d", tip, ofs+cnt))); 124 ofs + cnt);
126 html("'>[next]</a>&nbsp;");
127 } 125 }
128 html("</div>"); 126 html("</div>");
129 } 127 }
130} 128}
diff --git a/ui-repolist.c b/ui-repolist.c
index 2018dab..4c86543 100644
--- a/ui-repolist.c
+++ b/ui-repolist.c
@@ -31,68 +31,79 @@ static void print_modtime(struct repoinfo *repo)
31 struct stat s; 31 struct stat s;
32 32
33 path = fmt("%s/%s", repo->path, cgit_agefile); 33 path = fmt("%s/%s", repo->path, cgit_agefile);
34 if (stat(path, &s) == 0) { 34 if (stat(path, &s) == 0) {
35 cgit_print_age(read_agefile(path), -1, NULL); 35 cgit_print_age(read_agefile(path), -1, NULL);
36 return; 36 return;
37 } 37 }
38 38
39 path = fmt("%s/refs/heads/%s", repo->path, repo->defbranch); 39 path = fmt("%s/refs/heads/%s", repo->path, repo->defbranch);
40 if (stat(path, &s) != 0) 40 if (stat(path, &s) != 0)
41 return; 41 return;
42 cgit_print_age(s.st_mtime, -1, NULL); 42 cgit_print_age(s.st_mtime, -1, NULL);
43} 43}
44 44
45void cgit_print_repolist(struct cacheitem *item) 45void cgit_print_repolist(struct cacheitem *item)
46{ 46{
47 int i; 47 int i, columns = 4;
48 char *last_group = NULL; 48 char *last_group = NULL;
49 49
50 if (cgit_enable_index_links)
51 columns++;
52
50 cgit_print_docstart(cgit_root_title, item); 53 cgit_print_docstart(cgit_root_title, item);
51 cgit_print_pageheader(cgit_root_title, 0); 54 cgit_print_pageheader(cgit_root_title, 0);
52 55
53 html("<table class='list nowrap'>"); 56 html("<table class='list nowrap'>");
54 if (cgit_index_header) { 57 if (cgit_index_header) {
55 html("<tr class='nohover'><td colspan='5' class='include-block'>"); 58 htmlf("<tr class='nohover'><td colspan='%d' class='include-block'>",
59 columns);
56 html_include(cgit_index_header); 60 html_include(cgit_index_header);
57 html("</td></tr>"); 61 html("</td></tr>");
58 } 62 }
59 html("<tr class='nohover'>" 63 html("<tr class='nohover'>"
60 "<th class='left'>Name</th>" 64 "<th class='left'>Name</th>"
61 "<th class='left'>Description</th>" 65 "<th class='left'>Description</th>"
62 "<th class='left'>Owner</th>" 66 "<th class='left'>Owner</th>"
63 "<th class='left'>Idle</th>" 67 "<th class='left'>Idle</th>");
64 "<th>Links</th></tr>\n"); 68 if (cgit_enable_index_links)
69 html("<th>Links</th>");
70 html("</tr>\n");
65 71
66 for (i=0; i<cgit_repolist.count; i++) { 72 for (i=0; i<cgit_repolist.count; i++) {
67 cgit_repo = &cgit_repolist.repos[i]; 73 cgit_repo = &cgit_repolist.repos[i];
68 if ((last_group == NULL && cgit_repo->group != NULL) || 74 if ((last_group == NULL && cgit_repo->group != NULL) ||
69 (last_group != NULL && cgit_repo->group == NULL) || 75 (last_group != NULL && cgit_repo->group == NULL) ||
70 (last_group != NULL && cgit_repo->group != NULL && 76 (last_group != NULL && cgit_repo->group != NULL &&
71 strcmp(cgit_repo->group, last_group))) { 77 strcmp(cgit_repo->group, last_group))) {
72 html("<tr class='nohover'><td colspan='4' class='repogroup'>"); 78 htmlf("<tr class='nohover'><td colspan='%d' class='repogroup'>",
79 columns);
73 html_txt(cgit_repo->group); 80 html_txt(cgit_repo->group);
74 html("</td></tr>"); 81 html("</td></tr>");
75 last_group = cgit_repo->group; 82 last_group = cgit_repo->group;
76 } 83 }
77 htmlf("<tr><td class='%s'>", 84 htmlf("<tr><td class='%s'>",
78 cgit_repo->group ? "sublevel-repo" : "toplevel-repo"); 85 cgit_repo->group ? "sublevel-repo" : "toplevel-repo");
79 html_link_open(cgit_repourl(cgit_repo->url), NULL, NULL); 86 html_link_open(cgit_repourl(cgit_repo->url), NULL, NULL);
80 html_txt(cgit_repo->name); 87 html_txt(cgit_repo->name);
81 html_link_close(); 88 html_link_close();
82 html("</td><td>"); 89 html("</td><td>");
83 html_ntxt(cgit_max_repodesc_len, cgit_repo->desc); 90 html_ntxt(cgit_max_repodesc_len, cgit_repo->desc);
84 html("</td><td>"); 91 html("</td><td>");
85 html_txt(cgit_repo->owner); 92 html_txt(cgit_repo->owner);
86 html("</td><td>"); 93 html("</td><td>");
87 print_modtime(cgit_repo); 94 print_modtime(cgit_repo);
88 html("</td><td>"); 95 html("</td>");
89 html_link_open(cgit_repourl(cgit_repo->url), 96 if (cgit_enable_index_links) {
90 "Summary", "button"); 97 html("<td>");
91 html("S</a>"); 98 html_link_open(cgit_repourl(cgit_repo->url),
92 cgit_log_link("L", "Log", "button", NULL, NULL, NULL); 99 NULL, "button");
93 cgit_tree_link("F", "Files", "button", NULL, NULL, NULL); 100 html("summary</a>");
94 html("</td></tr>\n"); 101 cgit_log_link("log", NULL, "button", NULL, NULL, NULL, 0);
102 cgit_tree_link("tree", NULL, "button", NULL, NULL, NULL);
103 html("</td>");
104 }
105 html("</tr>\n");
95 } 106 }
96 html("</table>"); 107 html("</table>");
97 cgit_print_docend(); 108 cgit_print_docend();
98} 109}
diff --git a/ui-shared.c b/ui-shared.c
index 110c696..d4376ce 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -98,46 +98,50 @@ static char *repolink(char *title, char *class, char *page, char *head,
98 html_attr(title); 98 html_attr(title);
99 html("'"); 99 html("'");
100 } 100 }
101 if (class) { 101 if (class) {
102 html(" class='"); 102 html(" class='");
103 html_attr(class); 103 html_attr(class);
104 html("'"); 104 html("'");
105 } 105 }
106 html(" href='"); 106 html(" href='");
107 if (cgit_virtual_root) { 107 if (cgit_virtual_root) {
108 html_attr(cgit_virtual_root); 108 html_attr(cgit_virtual_root);
109 if (cgit_virtual_root[strlen(cgit_virtual_root) - 1] != '/') 109 if (cgit_virtual_root[strlen(cgit_virtual_root) - 1] != '/')
110 html("/"); 110 html("/");
111 html_attr(cgit_repo->url); 111 html_attr(cgit_repo->url);
112 if (cgit_repo->url[strlen(cgit_repo->url) - 1] != '/') 112 if (cgit_repo->url[strlen(cgit_repo->url) - 1] != '/')
113 html("/"); 113 html("/");
114 html(page); 114 if (page) {
115 html("/"); 115 html(page);
116 if (path) 116 html("/");
117 html_attr(path); 117 if (path)
118 html_attr(path);
119 }
118 } else { 120 } else {
119 html(cgit_script_name); 121 html(cgit_script_name);
120 html("?url="); 122 html("?url=");
121 html_attr(cgit_repo->url); 123 html_attr(cgit_repo->url);
122 if (cgit_repo->url[strlen(cgit_repo->url) - 1] != '/') 124 if (cgit_repo->url[strlen(cgit_repo->url) - 1] != '/')
123 html("/"); 125 html("/");
124 html(page); 126 if (page) {
125 html("/"); 127 html(page);
126 if (path) 128 html("/");
127 html_attr(path); 129 if (path)
130 html_attr(path);
131 }
128 delim = "&amp;"; 132 delim = "&amp;";
129 } 133 }
130 if (head && strcmp(head, cgit_repo->defbranch)) { 134 if (head && strcmp(head, cgit_repo->defbranch)) {
131 html(delim); 135 html(delim);
132 html("h="); 136 html("h=");
133 html_attr(head); 137 html_attr(head);
134 delim = "&amp;"; 138 delim = "&amp;";
135 } 139 }
136 return fmt("%s", delim); 140 return fmt("%s", delim);
137} 141}
138 142
139static void reporevlink(char *page, char *name, char *title, char *class, 143static void reporevlink(char *page, char *name, char *title, char *class,
140 char *head, char *rev, char *path) 144 char *head, char *rev, char *path)
141{ 145{
142 char *delim; 146 char *delim;
143 147
@@ -146,35 +150,51 @@ static void reporevlink(char *page, char *name, char *title, char *class,
146 html(delim); 150 html(delim);
147 html("id="); 151 html("id=");
148 html_attr(rev); 152 html_attr(rev);
149 } 153 }
150 html("'>"); 154 html("'>");
151 html_txt(name); 155 html_txt(name);
152 html("</a>"); 156 html("</a>");
153} 157}
154 158
155void cgit_tree_link(char *name, char *title, char *class, char *head, 159void cgit_tree_link(char *name, char *title, char *class, char *head,
156 char *rev, char *path) 160 char *rev, char *path)
157{ 161{
158 reporevlink("tree", name, title, class, head, rev, path); 162 reporevlink("tree", name, title, class, head, rev, path);
159} 163}
160 164
161void cgit_log_link(char *name, char *title, char *class, char *head, 165void cgit_log_link(char *name, char *title, char *class, char *head,
162 char *rev, char *path) 166 char *rev, char *path, int ofs)
163{ 167{
164 reporevlink("log", name, title, class, head, rev, path); 168 char *delim;
169
170 delim = repolink(title, class, "log", head, path);
171 if (rev && strcmp(rev, cgit_query_head)) {
172 html(delim);
173 html("id=");
174 html_attr(rev);
175 delim = "&";
176 }
177 if (ofs > 0) {
178 html(delim);
179 html("ofs=");
180 htmlf("%d", ofs);
181 }
182 html("'>");
183 html_txt(name);
184 html("</a>");
165} 185}
166 186
167void cgit_commit_link(char *name, char *title, char *class, char *head, 187void cgit_commit_link(char *name, char *title, char *class, char *head,
168 char *rev) 188 char *rev)
169{ 189{
170 if (strlen(name) > cgit_max_msg_len && cgit_max_msg_len >= 15) { 190 if (strlen(name) > cgit_max_msg_len && cgit_max_msg_len >= 15) {
171 name[cgit_max_msg_len] = '\0'; 191 name[cgit_max_msg_len] = '\0';
172 name[cgit_max_msg_len - 1] = '.'; 192 name[cgit_max_msg_len - 1] = '.';
173 name[cgit_max_msg_len - 2] = '.'; 193 name[cgit_max_msg_len - 2] = '.';
174 name[cgit_max_msg_len - 3] = '.'; 194 name[cgit_max_msg_len - 3] = '.';
175 } 195 }
176 reporevlink("commit", name, title, class, head, rev, NULL); 196 reporevlink("commit", name, title, class, head, rev, NULL);
177} 197}
178 198
179void cgit_diff_link(char *name, char *title, char *class, char *head, 199void cgit_diff_link(char *name, char *title, char *class, char *head,
180 char *new_rev, char *old_rev, char *path) 200 char *new_rev, char *old_rev, char *path)
@@ -266,45 +286,64 @@ void cgit_print_docstart(char *title, struct cacheitem *item)
266 html("<link rel='stylesheet' type='text/css' href='"); 286 html("<link rel='stylesheet' type='text/css' href='");
267 html_attr(cgit_css); 287 html_attr(cgit_css);
268 html("'/>\n"); 288 html("'/>\n");
269 html("</head>\n"); 289 html("</head>\n");
270 html("<body>\n"); 290 html("<body>\n");
271} 291}
272 292
273void cgit_print_docend() 293void cgit_print_docend()
274{ 294{
275 html("</td></tr></table>"); 295 html("</td></tr></table>");
276 html("</body>\n</html>\n"); 296 html("</body>\n</html>\n");
277} 297}
278 298
279void cgit_print_pageheader(char *title, int show_search) 299void cgit_print_pageheader(char *title, int show_search)
280{ 300{
281 html("<table id='layout'>"); 301 html("<table id='layout'>");
282 html("<tr><td id='header'>"); 302 html("<tr><td id='header'><a href='");
283 html(cgit_root_title); 303 html_attr(cgit_rooturl());
284 html("</td><td id='logo'>"); 304 html("'>");
305 html_txt(cgit_root_title);
306 html("</a></td><td id='logo'>");
285 html("<a href='"); 307 html("<a href='");
286 html_attr(cgit_logo_link); 308 html_attr(cgit_logo_link);
287 htmlf("'><img src='%s' alt='logo'/></a>", cgit_logo); 309 htmlf("'><img src='%s' alt='logo'/></a>", cgit_logo);
288 html("</td></tr>"); 310 html("</td></tr>");
289 html("<tr><td id='crumb'>"); 311 html("<tr><td id='crumb'>");
290 htmlf("<a href='%s'>root</a>", cgit_rooturl());
291 if (cgit_query_repo) { 312 if (cgit_query_repo) {
292 htmlf(" : <a href='%s'>", cgit_repourl(cgit_repo->url));
293 html_txt(cgit_repo->name); 313 html_txt(cgit_repo->name);
294 htmlf("</a> : %s", title); 314 html(" (");
315 html_txt(cgit_query_head);
316 html(") : &nbsp;");
317 reporevlink(NULL, "summary", NULL, NULL, cgit_query_head,
318 NULL, NULL);
319 html(" ");
320 cgit_log_link("log", NULL, NULL, cgit_query_head,
321 cgit_query_sha1, cgit_query_path, 0);
322 html(" ");
323 cgit_tree_link("tree", NULL, NULL, cgit_query_head,
324 cgit_query_sha1, NULL);
325 html(" ");
326 cgit_commit_link("commit", NULL, NULL, cgit_query_head,
327 cgit_query_sha1);
328 html(" ");
329 cgit_diff_link("diff", NULL, NULL, cgit_query_head,
330 cgit_query_sha1, cgit_query_sha2,
331 cgit_query_path);
332 } else {
333 html_txt("Index of repositories");
295 } 334 }
296 html("</td>"); 335 html("</td>");
297 html("<td id='search'>"); 336 html("<td id='search'>");
298 if (show_search) { 337 if (show_search) {
299 html("<form method='get' action='"); 338 html("<form method='get' action='");
300 html_attr(cgit_currurl()); 339 html_attr(cgit_currurl());
301 html("'>"); 340 html("'>");
302 if (!cgit_virtual_root) { 341 if (!cgit_virtual_root) {
303 if (cgit_query_repo) 342 if (cgit_query_repo)
304 html_hidden("r", cgit_query_repo); 343 html_hidden("r", cgit_query_repo);
305 if (cgit_query_page) 344 if (cgit_query_page)
306 html_hidden("p", cgit_query_page); 345 html_hidden("p", cgit_query_page);
307 } 346 }
308 if (cgit_query_head) 347 if (cgit_query_head)
309 html_hidden("h", cgit_query_head); 348 html_hidden("h", cgit_query_head);
310 if (cgit_query_sha1) 349 if (cgit_query_sha1)
diff --git a/ui-summary.c b/ui-summary.c
index 03dd078..b4bc6d8 100644
--- a/ui-summary.c
+++ b/ui-summary.c
@@ -14,33 +14,33 @@ static 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]; 18 char buf[256];
19 char *ref; 19 char *ref;
20 20
21 ref = xstrdup(refname); 21 ref = xstrdup(refname);
22 strncpy(buf, refname, sizeof(buf)); 22 strncpy(buf, refname, sizeof(buf));
23 commit = lookup_commit(sha1); 23 commit = lookup_commit(sha1);
24 // object is not really parsed at this point, because of some fallout 24 // object is not really parsed at this point, because of some fallout
25 // from previous calls to git functions in cgit_print_log() 25 // from previous calls to git functions in cgit_print_log()
26 commit->object.parsed = 0; 26 commit->object.parsed = 0;
27 if (commit && !parse_commit(commit)){ 27 if (commit && !parse_commit(commit)){
28 info = cgit_parse_commit(commit); 28 info = cgit_parse_commit(commit);
29 html("<tr><td>"); 29 html("<tr><td>");
30 cgit_log_link(ref, NULL, NULL, ref, NULL, NULL); 30 cgit_log_link(ref, NULL, NULL, ref, NULL, NULL, 0);
31 html("</td><td>"); 31 html("</td><td>");
32 cgit_print_age(commit->date, -1, NULL); 32 cgit_print_age(commit->date, -1, NULL);
33 html("</td><td>"); 33 html("</td><td>");
34 html_txt(info->author); 34 html_txt(info->author);
35 html("</td><td>"); 35 html("</td><td>");
36 cgit_commit_link(info->subject, NULL, NULL, ref, NULL); 36 cgit_commit_link(info->subject, NULL, NULL, ref, NULL);
37 html("</td></tr>\n"); 37 html("</td></tr>\n");
38 cgit_free_commitinfo(info); 38 cgit_free_commitinfo(info);
39 } else { 39 } else {
40 html("<tr><td>"); 40 html("<tr><td>");
41 html_txt(buf); 41 html_txt(buf);
42 html("</td><td colspan='3'>"); 42 html("</td><td colspan='3'>");
43 htmlf("*** bad ref %s ***", sha1_to_hex(sha1)); 43 htmlf("*** bad ref %s ***", sha1_to_hex(sha1));
44 html("</td></tr>\n"); 44 html("</td></tr>\n");
45 } 45 }
46 free(ref); 46 free(ref);
diff --git a/ui-tree.c b/ui-tree.c
index 1037c82..c5d64ff 100644
--- a/ui-tree.c
+++ b/ui-tree.c
@@ -79,34 +79,34 @@ static int ls_item(const unsigned char *sha1, const char *base, int baselen,
79 html_attr(fmt(cgit_repo->module_link, 79 html_attr(fmt(cgit_repo->module_link,
80 name, 80 name,
81 sha1_to_hex(sha1))); 81 sha1_to_hex(sha1)));
82 html("'>"); 82 html("'>");
83 html_txt(name); 83 html_txt(name);
84 html("</a>"); 84 html("</a>");
85 } else if (S_ISDIR(mode)) { 85 } else if (S_ISDIR(mode)) {
86 cgit_tree_link(name, NULL, "ls-dir", cgit_query_head, 86 cgit_tree_link(name, NULL, "ls-dir", cgit_query_head,
87 curr_rev, fullpath); 87 curr_rev, fullpath);
88 } else { 88 } else {
89 cgit_tree_link(name, NULL, "ls-blob", cgit_query_head, 89 cgit_tree_link(name, NULL, "ls-blob", cgit_query_head,
90 curr_rev, fullpath); 90 curr_rev, fullpath);
91 } 91 }
92 htmlf("</td><td class='ls-size'>%li</td>", size); 92 htmlf("</td><td class='ls-size'>%li</td>", size);
93 93
94 html("<td>"); 94 html("<td>");
95 cgit_log_link("L", "Log", "button", cgit_query_head, curr_rev, 95 cgit_log_link("log", NULL, "button", cgit_query_head, curr_rev,
96 fullpath); 96 fullpath, 0);
97 html("</td></tr>\n"); 97 html("</td></tr>\n");
98 free(name); 98 free(name);
99 return 0; 99 return 0;
100} 100}
101 101
102static void ls_head() 102static void ls_head()
103{ 103{
104 html("<table class='list'>\n"); 104 html("<table class='list'>\n");
105 html("<tr class='nohover'>"); 105 html("<tr class='nohover'>");
106 html("<th class='left'>Mode</th>"); 106 html("<th class='left'>Mode</th>");
107 html("<th class='left'>Name</th>"); 107 html("<th class='left'>Name</th>");
108 html("<th class='right'>Size</th>"); 108 html("<th class='right'>Size</th>");
109 html("<th/>"); 109 html("<th/>");
110 html("</tr>\n"); 110 html("</tr>\n");
111 header = 1; 111 header = 1;
112} 112}