summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--cgit.c2
-rw-r--r--cgit.css15
-rw-r--r--cgit.h1
-rw-r--r--ui-log.c35
-rw-r--r--ui-refs.c3
-rw-r--r--ui-repolist.c2
-rw-r--r--ui-shared.c12
-rw-r--r--ui-shared.h2
-rw-r--r--ui-tree.c2
9 files changed, 61 insertions, 13 deletions
diff --git a/cgit.c b/cgit.c
index e09c86e..166fbc6 100644
--- a/cgit.c
+++ b/cgit.c
@@ -143,32 +143,34 @@ static void querystring_cb(const char *name, const char *value)
143 } else if (!strcmp(name, "id")) { 143 } else if (!strcmp(name, "id")) {
144 ctx.qry.sha1 = xstrdup(value); 144 ctx.qry.sha1 = xstrdup(value);
145 ctx.qry.has_sha1 = 1; 145 ctx.qry.has_sha1 = 1;
146 } else if (!strcmp(name, "id2")) { 146 } else if (!strcmp(name, "id2")) {
147 ctx.qry.sha2 = xstrdup(value); 147 ctx.qry.sha2 = xstrdup(value);
148 ctx.qry.has_sha1 = 1; 148 ctx.qry.has_sha1 = 1;
149 } else if (!strcmp(name, "ofs")) { 149 } else if (!strcmp(name, "ofs")) {
150 ctx.qry.ofs = atoi(value); 150 ctx.qry.ofs = atoi(value);
151 } else if (!strcmp(name, "path")) { 151 } else if (!strcmp(name, "path")) {
152 ctx.qry.path = trim_end(value, '/'); 152 ctx.qry.path = trim_end(value, '/');
153 } else if (!strcmp(name, "name")) { 153 } else if (!strcmp(name, "name")) {
154 ctx.qry.name = xstrdup(value); 154 ctx.qry.name = xstrdup(value);
155 } else if (!strcmp(name, "mimetype")) { 155 } else if (!strcmp(name, "mimetype")) {
156 ctx.qry.mimetype = xstrdup(value); 156 ctx.qry.mimetype = xstrdup(value);
157 } else if (!strcmp(name, "s")){ 157 } else if (!strcmp(name, "s")){
158 ctx.qry.sort = xstrdup(value); 158 ctx.qry.sort = xstrdup(value);
159 } else if (!strcmp(name, "showmsg")) {
160 ctx.qry.showmsg = atoi(value);
159 } 161 }
160} 162}
161 163
162static void prepare_context(struct cgit_context *ctx) 164static void prepare_context(struct cgit_context *ctx)
163{ 165{
164 memset(ctx, 0, sizeof(ctx)); 166 memset(ctx, 0, sizeof(ctx));
165 ctx->cfg.agefile = "info/web/last-modified"; 167 ctx->cfg.agefile = "info/web/last-modified";
166 ctx->cfg.nocache = 0; 168 ctx->cfg.nocache = 0;
167 ctx->cfg.cache_size = 0; 169 ctx->cfg.cache_size = 0;
168 ctx->cfg.cache_dynamic_ttl = 5; 170 ctx->cfg.cache_dynamic_ttl = 5;
169 ctx->cfg.cache_max_create_time = 5; 171 ctx->cfg.cache_max_create_time = 5;
170 ctx->cfg.cache_repo_ttl = 5; 172 ctx->cfg.cache_repo_ttl = 5;
171 ctx->cfg.cache_root = CGIT_CACHE_ROOT; 173 ctx->cfg.cache_root = CGIT_CACHE_ROOT;
172 ctx->cfg.cache_root_ttl = 5; 174 ctx->cfg.cache_root_ttl = 5;
173 ctx->cfg.cache_static_ttl = -1; 175 ctx->cfg.cache_static_ttl = -1;
174 ctx->cfg.css = "/cgit.css"; 176 ctx->cfg.css = "/cgit.css";
diff --git a/cgit.css b/cgit.css
index a37d218..7928c2f 100644
--- a/cgit.css
+++ b/cgit.css
@@ -107,55 +107,70 @@ div.content {
107 padding: 2em; 107 padding: 2em;
108 border-top: solid 3px #ccc; 108 border-top: solid 3px #ccc;
109 border-bottom: solid 3px #ccc; 109 border-bottom: solid 3px #ccc;
110} 110}
111 111
112 112
113table.list { 113table.list {
114 width: 100%; 114 width: 100%;
115 border: none; 115 border: none;
116 border-collapse: collapse; 116 border-collapse: collapse;
117} 117}
118 118
119table.list tr { 119table.list tr {
120 background: white; 120 background: white;
121} 121}
122 122
123table.list tr.logheader {
124 background: #eee;
125}
126
123table.list tr:hover { 127table.list tr:hover {
124 background: #eee; 128 background: #eee;
125} 129}
126 130
127table.list tr.nohover:hover { 131table.list tr.nohover:hover {
128 background: white; 132 background: white;
129} 133}
130 134
131table.list th { 135table.list th {
132 font-weight: bold; 136 font-weight: bold;
133 /* color: #888; 137 /* color: #888;
134 border-top: dashed 1px #888; 138 border-top: dashed 1px #888;
135 border-bottom: dashed 1px #888; 139 border-bottom: dashed 1px #888;
136 */ 140 */
137 padding: 0.1em 0.5em 0.05em 0.5em; 141 padding: 0.1em 0.5em 0.05em 0.5em;
138 vertical-align: baseline; 142 vertical-align: baseline;
139} 143}
140 144
141table.list td { 145table.list td {
142 border: none; 146 border: none;
143 padding: 0.1em 0.5em 0.1em 0.5em; 147 padding: 0.1em 0.5em 0.1em 0.5em;
144} 148}
145 149
150table.list td.logsubject {
151 font-family: monospace;
152 font-weight: bold;
153}
154
155table.list td.logmsg {
156 font-family: monospace;
157 white-space: pre;
158 padding: 1em 0em 2em 0em;
159}
160
146table.list td a { 161table.list td a {
147 color: black; 162 color: black;
148} 163}
149 164
150table.list td a:hover { 165table.list td a:hover {
151 color: #00f; 166 color: #00f;
152} 167}
153 168
154img { 169img {
155 border: none; 170 border: none;
156} 171}
157 172
158input#switch-btn { 173input#switch-btn {
159 margin: 2px 0px 0px 0px; 174 margin: 2px 0px 0px 0px;
160} 175}
161 176
diff --git a/cgit.h b/cgit.h
index f1fbeca..cb2f176 100644
--- a/cgit.h
+++ b/cgit.h
@@ -110,32 +110,33 @@ struct cgit_query {
110 int has_sha1; 110 int has_sha1;
111 char *raw; 111 char *raw;
112 char *repo; 112 char *repo;
113 char *page; 113 char *page;
114 char *search; 114 char *search;
115 char *grep; 115 char *grep;
116 char *head; 116 char *head;
117 char *sha1; 117 char *sha1;
118 char *sha2; 118 char *sha2;
119 char *path; 119 char *path;
120 char *name; 120 char *name;
121 char *mimetype; 121 char *mimetype;
122 char *url; 122 char *url;
123 int ofs; 123 int ofs;
124 int nohead; 124 int nohead;
125 char *sort; 125 char *sort;
126 int showmsg;
126}; 127};
127 128
128struct cgit_config { 129struct cgit_config {
129 char *agefile; 130 char *agefile;
130 char *cache_root; 131 char *cache_root;
131 char *clone_prefix; 132 char *clone_prefix;
132 char *css; 133 char *css;
133 char *favicon; 134 char *favicon;
134 char *footer; 135 char *footer;
135 char *index_header; 136 char *index_header;
136 char *index_info; 137 char *index_info;
137 char *logo; 138 char *logo;
138 char *logo_link; 139 char *logo_link;
139 char *module_link; 140 char *module_link;
140 char *repo_group; 141 char *repo_group;
141 char *robots; 142 char *robots;
diff --git a/ui-log.c b/ui-log.c
index d212984..2f90778 100644
--- a/ui-log.c
+++ b/ui-log.c
@@ -22,58 +22,72 @@ void count_lines(char *line, int size)
22 22
23 else if (line[0] == '-') 23 else if (line[0] == '-')
24 rem_lines++; 24 rem_lines++;
25} 25}
26 26
27void inspect_files(struct diff_filepair *pair) 27void inspect_files(struct diff_filepair *pair)
28{ 28{
29 files++; 29 files++;
30 if (ctx.repo->enable_log_linecount) 30 if (ctx.repo->enable_log_linecount)
31 cgit_diff_files(pair->one->sha1, pair->two->sha1, count_lines); 31 cgit_diff_files(pair->one->sha1, pair->two->sha1, count_lines);
32} 32}
33 33
34void print_commit(struct commit *commit) 34void print_commit(struct commit *commit)
35{ 35{
36 struct commitinfo *info; 36 struct commitinfo *info;
37 char *tmp; 37 char *tmp;
38 int cols = 2;
38 39
39 info = cgit_parse_commit(commit); 40 info = cgit_parse_commit(commit);
40 html("<tr><td>"); 41 htmlf("<tr%s><td>",
42 ctx.qry.showmsg ? " class='logheader'" : "");
41 tmp = fmt("id=%s", sha1_to_hex(commit->object.sha1)); 43 tmp = fmt("id=%s", sha1_to_hex(commit->object.sha1));
42 tmp = cgit_pageurl(ctx.repo->url, "commit", tmp); 44 tmp = cgit_pageurl(ctx.repo->url, "commit", tmp);
43 html_link_open(tmp, NULL, NULL); 45 html_link_open(tmp, NULL, NULL);
44 cgit_print_age(commit->date, TM_WEEK * 2, FMT_SHORTDATE); 46 cgit_print_age(commit->date, TM_WEEK * 2, FMT_SHORTDATE);
45 html_link_close(); 47 html_link_close();
46 html("</td><td>"); 48 htmlf("</td><td%s>",
49 ctx.qry.showmsg ? " class='logsubject'" : "");
47 cgit_commit_link(info->subject, NULL, NULL, ctx.qry.head, 50 cgit_commit_link(info->subject, NULL, NULL, ctx.qry.head,
48 sha1_to_hex(commit->object.sha1)); 51 sha1_to_hex(commit->object.sha1));
49 html("</td><td>"); 52 html("</td><td>");
50 html_txt(info->author); 53 html_txt(info->author);
51 if (ctx.repo->enable_log_filecount) { 54 if (ctx.repo->enable_log_filecount) {
52 files = 0; 55 files = 0;
53 add_lines = 0; 56 add_lines = 0;
54 rem_lines = 0; 57 rem_lines = 0;
55 cgit_diff_commit(commit, inspect_files); 58 cgit_diff_commit(commit, inspect_files);
56 html("</td><td>"); 59 html("</td><td>");
57 htmlf("%d", files); 60 htmlf("%d", files);
58 if (ctx.repo->enable_log_linecount) { 61 if (ctx.repo->enable_log_linecount) {
59 html("</td><td>"); 62 html("</td><td>");
60 htmlf("-%d/+%d", rem_lines, add_lines); 63 htmlf("-%d/+%d", rem_lines, add_lines);
61 } 64 }
62 } 65 }
63 html("</td></tr>\n"); 66 html("</td></tr>\n");
67 if (ctx.qry.showmsg) {
68 if (ctx.repo->enable_log_filecount) {
69 cols++;
70 if (ctx.repo->enable_log_linecount)
71 cols++;
72 }
73 htmlf("<tr class='nohover'><td/><td colspan='%d' class='logmsg'>",
74 cols);
75 html_txt(info->msg);
76 html("</td></tr>\n");
77 }
64 cgit_free_commitinfo(info); 78 cgit_free_commitinfo(info);
65} 79}
66 80
67static const char *disambiguate_ref(const char *ref) 81static const char *disambiguate_ref(const char *ref)
68{ 82{
69 unsigned char sha1[20]; 83 unsigned char sha1[20];
70 const char *longref; 84 const char *longref;
71 85
72 longref = fmt("refs/heads/%s", ref); 86 longref = fmt("refs/heads/%s", ref);
73 if (get_sha1(longref, sha1) == 0) 87 if (get_sha1(longref, sha1) == 0)
74 return longref; 88 return longref;
75 89
76 return ref; 90 return ref;
77} 91}
78 92
79void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern, 93void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern,
@@ -100,34 +114,41 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern
100 argv[argc++] = path; 114 argv[argc++] = path;
101 } 115 }
102 init_revisions(&rev, NULL); 116 init_revisions(&rev, NULL);
103 rev.abbrev = DEFAULT_ABBREV; 117 rev.abbrev = DEFAULT_ABBREV;
104 rev.commit_format = CMIT_FMT_DEFAULT; 118 rev.commit_format = CMIT_FMT_DEFAULT;
105 rev.verbose_header = 1; 119 rev.verbose_header = 1;
106 rev.show_root_diff = 0; 120 rev.show_root_diff = 0;
107 setup_revisions(argc, argv, &rev, NULL); 121 setup_revisions(argc, argv, &rev, NULL);
108 rev.grep_filter.regflags |= REG_ICASE; 122 rev.grep_filter.regflags |= REG_ICASE;
109 compile_grep_patterns(&rev.grep_filter); 123 compile_grep_patterns(&rev.grep_filter);
110 prepare_revision_walk(&rev); 124 prepare_revision_walk(&rev);
111 125
112 if (pager) 126 if (pager)
113 html("<table class='list nowrap'>"); 127 html("<table class='list nowrap'>");
114 128
115 html("<tr class='nohover'><th class='left'>Age</th>" 129 html("<tr class='nohover'><th class='left'>Age</th>"
116 "<th class='left'>Commit message</th>" 130 "<th class='left'>Commit message");
117 "<th class='left'>Author</th>"); 131 if (pager) {
132 html(" (");
133 cgit_log_link("toggle", NULL, NULL, ctx.qry.head, ctx.qry.sha1,
134 ctx.qry.path, ctx.qry.ofs, ctx.qry.grep,
135 ctx.qry.search, ctx.qry.showmsg ? 0 : 1);
136 html(")");
137 }
138 html("</th><th class='left'>Author</th>");
118 if (ctx.repo->enable_log_filecount) { 139 if (ctx.repo->enable_log_filecount) {
119 html("<th class='left'>Files</th>"); 140 html("<th class='left'>Files</th>");
120 columns++; 141 columns++;
121 if (ctx.repo->enable_log_linecount) { 142 if (ctx.repo->enable_log_linecount) {
122 html("<th class='left'>Lines</th>"); 143 html("<th class='left'>Lines</th>");
123 columns++; 144 columns++;
124 } 145 }
125 } 146 }
126 html("</tr>\n"); 147 html("</tr>\n");
127 148
128 if (ofs<0) 149 if (ofs<0)
129 ofs = 0; 150 ofs = 0;
130 151
131 for (i = 0; i < ofs && (commit = get_revision(&rev)) != NULL; i++) { 152 for (i = 0; i < ofs && (commit = get_revision(&rev)) != NULL; i++) {
132 free(commit->buffer); 153 free(commit->buffer);
133 commit->buffer = NULL; 154 commit->buffer = NULL;
@@ -136,33 +157,33 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern
136 } 157 }
137 158
138 for (i = 0; i < cnt && (commit = get_revision(&rev)) != NULL; i++) { 159 for (i = 0; i < cnt && (commit = get_revision(&rev)) != NULL; i++) {
139 print_commit(commit); 160 print_commit(commit);
140 free(commit->buffer); 161 free(commit->buffer);
141 commit->buffer = NULL; 162 commit->buffer = NULL;
142 free_commit_list(commit->parents); 163 free_commit_list(commit->parents);
143 commit->parents = NULL; 164 commit->parents = NULL;
144 } 165 }
145 if (pager) { 166 if (pager) {
146 htmlf("</table><div class='pager'>", 167 htmlf("</table><div class='pager'>",
147 columns); 168 columns);
148 if (ofs > 0) { 169 if (ofs > 0) {
149 cgit_log_link("[prev]", NULL, NULL, ctx.qry.head, 170 cgit_log_link("[prev]", NULL, NULL, ctx.qry.head,
150 ctx.qry.sha1, ctx.qry.path, 171 ctx.qry.sha1, ctx.qry.path,
151 ofs - cnt, ctx.qry.grep, 172 ofs - cnt, ctx.qry.grep,
152 ctx.qry.search); 173 ctx.qry.search, ctx.qry.showmsg);
153 html("&nbsp;"); 174 html("&nbsp;");
154 } 175 }
155 if ((commit = get_revision(&rev)) != NULL) { 176 if ((commit = get_revision(&rev)) != NULL) {
156 cgit_log_link("[next]", NULL, NULL, ctx.qry.head, 177 cgit_log_link("[next]", NULL, NULL, ctx.qry.head,
157 ctx.qry.sha1, ctx.qry.path, 178 ctx.qry.sha1, ctx.qry.path,
158 ofs + cnt, ctx.qry.grep, 179 ofs + cnt, ctx.qry.grep,
159 ctx.qry.search); 180 ctx.qry.search, ctx.qry.showmsg);
160 } 181 }
161 html("</div>"); 182 html("</div>");
162 } else if ((commit = get_revision(&rev)) != NULL) { 183 } else if ((commit = get_revision(&rev)) != NULL) {
163 html("<tr class='nohover'><td colspan='3'>"); 184 html("<tr class='nohover'><td colspan='3'>");
164 cgit_log_link("[...]", NULL, NULL, ctx.qry.head, NULL, NULL, 0, 185 cgit_log_link("[...]", NULL, NULL, ctx.qry.head, NULL, NULL, 0,
165 NULL, NULL); 186 NULL, NULL, ctx.qry.showmsg);
166 html("</td></tr>\n"); 187 html("</td></tr>\n");
167 } 188 }
168} 189}
diff --git a/ui-refs.c b/ui-refs.c
index 0805fc8..d61ee7c 100644
--- a/ui-refs.c
+++ b/ui-refs.c
@@ -45,33 +45,34 @@ static int cmp_branch_age(const void *a, const void *b)
45static int cmp_tag_age(const void *a, const void *b) 45static int cmp_tag_age(const void *a, const void *b)
46{ 46{
47 struct refinfo *r1 = *(struct refinfo **)a; 47 struct refinfo *r1 = *(struct refinfo **)a;
48 struct refinfo *r2 = *(struct refinfo **)b; 48 struct refinfo *r2 = *(struct refinfo **)b;
49 49
50 return cmp_age(r1->tag->tagger_date, r2->tag->tagger_date); 50 return cmp_age(r1->tag->tagger_date, r2->tag->tagger_date);
51} 51}
52 52
53static int print_branch(struct refinfo *ref) 53static int print_branch(struct refinfo *ref)
54{ 54{
55 struct commitinfo *info = ref->commit; 55 struct commitinfo *info = ref->commit;
56 char *name = (char *)ref->refname; 56 char *name = (char *)ref->refname;
57 57
58 if (!info) 58 if (!info)
59 return 1; 59 return 1;
60 html("<tr><td>"); 60 html("<tr><td>");
61 cgit_log_link(name, NULL, NULL, name, NULL, NULL, 0, NULL, NULL); 61 cgit_log_link(name, NULL, NULL, name, NULL, NULL, 0, NULL, NULL,
62 ctx.qry.showmsg);
62 html("</td><td>"); 63 html("</td><td>");
63 64
64 if (ref->object->type == OBJ_COMMIT) { 65 if (ref->object->type == OBJ_COMMIT) {
65 cgit_commit_link(info->subject, NULL, NULL, name, NULL); 66 cgit_commit_link(info->subject, NULL, NULL, name, NULL);
66 html("</td><td>"); 67 html("</td><td>");
67 html_txt(info->author); 68 html_txt(info->author);
68 html("</td><td colspan='2'>"); 69 html("</td><td colspan='2'>");
69 cgit_print_age(info->commit->date, -1, NULL); 70 cgit_print_age(info->commit->date, -1, NULL);
70 } else { 71 } else {
71 html("</td><td></td><td>"); 72 html("</td><td></td><td>");
72 cgit_object_link(ref->object); 73 cgit_object_link(ref->object);
73 } 74 }
74 html("</td></tr>\n"); 75 html("</td></tr>\n");
75 return 0; 76 return 0;
76} 77}
77 78
diff --git a/ui-repolist.c b/ui-repolist.c
index 87196f0..2c13d50 100644
--- a/ui-repolist.c
+++ b/ui-repolist.c
@@ -244,33 +244,33 @@ void cgit_print_repolist()
244 htmlf("<tr><td class='%s'>", 244 htmlf("<tr><td class='%s'>",
245 !sorted && ctx.repo->group ? "sublevel-repo" : "toplevel-repo"); 245 !sorted && ctx.repo->group ? "sublevel-repo" : "toplevel-repo");
246 cgit_summary_link(ctx.repo->name, ctx.repo->name, NULL, NULL); 246 cgit_summary_link(ctx.repo->name, ctx.repo->name, NULL, NULL);
247 html("</td><td>"); 247 html("</td><td>");
248 html_link_open(cgit_repourl(ctx.repo->url), NULL, NULL); 248 html_link_open(cgit_repourl(ctx.repo->url), NULL, NULL);
249 html_ntxt(ctx.cfg.max_repodesc_len, ctx.repo->desc); 249 html_ntxt(ctx.cfg.max_repodesc_len, ctx.repo->desc);
250 html_link_close(); 250 html_link_close();
251 html("</td><td>"); 251 html("</td><td>");
252 html_txt(ctx.repo->owner); 252 html_txt(ctx.repo->owner);
253 html("</td><td>"); 253 html("</td><td>");
254 print_modtime(ctx.repo); 254 print_modtime(ctx.repo);
255 html("</td>"); 255 html("</td>");
256 if (ctx.cfg.enable_index_links) { 256 if (ctx.cfg.enable_index_links) {
257 html("<td>"); 257 html("<td>");
258 cgit_summary_link("summary", NULL, "button", NULL); 258 cgit_summary_link("summary", NULL, "button", NULL);
259 cgit_log_link("log", NULL, "button", NULL, NULL, NULL, 259 cgit_log_link("log", NULL, "button", NULL, NULL, NULL,
260 0, NULL, NULL); 260 0, NULL, NULL, ctx.qry.showmsg);
261 cgit_tree_link("tree", NULL, "button", NULL, NULL, NULL); 261 cgit_tree_link("tree", NULL, "button", NULL, NULL, NULL);
262 html("</td>"); 262 html("</td>");
263 } 263 }
264 html("</tr>\n"); 264 html("</tr>\n");
265 } 265 }
266 html("</table>"); 266 html("</table>");
267 if (!hits) 267 if (!hits)
268 cgit_print_error("No repositories found"); 268 cgit_print_error("No repositories found");
269 else if (hits > ctx.cfg.max_repo_count) 269 else if (hits > ctx.cfg.max_repo_count)
270 print_pager(hits, ctx.cfg.max_repo_count, ctx.qry.search); 270 print_pager(hits, ctx.cfg.max_repo_count, ctx.qry.search);
271 cgit_print_docend(); 271 cgit_print_docend();
272} 272}
273 273
274void cgit_print_site_readme() 274void cgit_print_site_readme()
275{ 275{
276 if (ctx.cfg.root_readme) 276 if (ctx.cfg.root_readme)
diff --git a/ui-shared.c b/ui-shared.c
index 9319881..95dfeb4 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -268,56 +268,62 @@ void cgit_tag_link(char *name, char *title, char *class, char *head,
268 reporevlink("tag", name, title, class, head, rev, NULL); 268 reporevlink("tag", name, title, class, head, rev, NULL);
269} 269}
270 270
271void cgit_tree_link(char *name, char *title, char *class, char *head, 271void cgit_tree_link(char *name, char *title, char *class, char *head,
272 char *rev, char *path) 272 char *rev, char *path)
273{ 273{
274 reporevlink("tree", name, title, class, head, rev, path); 274 reporevlink("tree", name, title, class, head, rev, path);
275} 275}
276 276
277void cgit_plain_link(char *name, char *title, char *class, char *head, 277void cgit_plain_link(char *name, char *title, char *class, char *head,
278 char *rev, char *path) 278 char *rev, char *path)
279{ 279{
280 reporevlink("plain", name, title, class, head, rev, path); 280 reporevlink("plain", name, title, class, head, rev, path);
281} 281}
282 282
283void cgit_log_link(char *name, char *title, char *class, char *head, 283void cgit_log_link(char *name, char *title, char *class, char *head,
284 char *rev, char *path, int ofs, char *grep, char *pattern) 284 char *rev, char *path, int ofs, char *grep, char *pattern,
285 int showmsg)
285{ 286{
286 char *delim; 287 char *delim;
287 288
288 delim = repolink(title, class, "log", head, path); 289 delim = repolink(title, class, "log", head, path);
289 if (rev && strcmp(rev, ctx.qry.head)) { 290 if (rev && strcmp(rev, ctx.qry.head)) {
290 html(delim); 291 html(delim);
291 html("id="); 292 html("id=");
292 html_url_arg(rev); 293 html_url_arg(rev);
293 delim = "&"; 294 delim = "&";
294 } 295 }
295 if (grep && pattern) { 296 if (grep && pattern) {
296 html(delim); 297 html(delim);
297 html("qt="); 298 html("qt=");
298 html_url_arg(grep); 299 html_url_arg(grep);
299 delim = "&"; 300 delim = "&";
300 html(delim); 301 html(delim);
301 html("q="); 302 html("q=");
302 html_url_arg(pattern); 303 html_url_arg(pattern);
303 } 304 }
304 if (ofs > 0) { 305 if (ofs > 0) {
305 html(delim); 306 html(delim);
306 html("ofs="); 307 html("ofs=");
307 htmlf("%d", ofs); 308 htmlf("%d", ofs);
309 delim = "&";
310 }
311 if (showmsg) {
312 html(delim);
313 html("showmsg=1");
308 } 314 }
309 html("'>"); 315 html("'>");
310 html_txt(name); 316 html_txt(name);
311 html("</a>"); 317 html("</a>");
312} 318}
313 319
314void cgit_commit_link(char *name, char *title, char *class, char *head, 320void cgit_commit_link(char *name, char *title, char *class, char *head,
315 char *rev) 321 char *rev)
316{ 322{
317 if (strlen(name) > ctx.cfg.max_msg_len && ctx.cfg.max_msg_len >= 15) { 323 if (strlen(name) > ctx.cfg.max_msg_len && ctx.cfg.max_msg_len >= 15) {
318 name[ctx.cfg.max_msg_len] = '\0'; 324 name[ctx.cfg.max_msg_len] = '\0';
319 name[ctx.cfg.max_msg_len - 1] = '.'; 325 name[ctx.cfg.max_msg_len - 1] = '.';
320 name[ctx.cfg.max_msg_len - 2] = '.'; 326 name[ctx.cfg.max_msg_len - 2] = '.';
321 name[ctx.cfg.max_msg_len - 3] = '.'; 327 name[ctx.cfg.max_msg_len - 3] = '.';
322 } 328 }
323 reporevlink("commit", name, title, class, head, rev, NULL); 329 reporevlink("commit", name, title, class, head, rev, NULL);
@@ -557,32 +563,34 @@ void add_hidden_formfields(int incl_head, int incl_search, char *page)
557 563
558 if (!ctx.cfg.virtual_root) { 564 if (!ctx.cfg.virtual_root) {
559 url = fmt("%s/%s", ctx.qry.repo, page); 565 url = fmt("%s/%s", ctx.qry.repo, page);
560 if (ctx.qry.path) 566 if (ctx.qry.path)
561 url = fmt("%s/%s", url, ctx.qry.path); 567 url = fmt("%s/%s", url, ctx.qry.path);
562 html_hidden("url", url); 568 html_hidden("url", url);
563 } 569 }
564 570
565 if (incl_head && ctx.qry.head && ctx.repo->defbranch && 571 if (incl_head && ctx.qry.head && ctx.repo->defbranch &&
566 strcmp(ctx.qry.head, ctx.repo->defbranch)) 572 strcmp(ctx.qry.head, ctx.repo->defbranch))
567 html_hidden("h", ctx.qry.head); 573 html_hidden("h", ctx.qry.head);
568 574
569 if (ctx.qry.sha1) 575 if (ctx.qry.sha1)
570 html_hidden("id", ctx.qry.sha1); 576 html_hidden("id", ctx.qry.sha1);
571 if (ctx.qry.sha2) 577 if (ctx.qry.sha2)
572 html_hidden("id2", ctx.qry.sha2); 578 html_hidden("id2", ctx.qry.sha2);
579 if (ctx.qry.showmsg)
580 html_hidden("showmsg", "1");
573 581
574 if (incl_search) { 582 if (incl_search) {
575 if (ctx.qry.grep) 583 if (ctx.qry.grep)
576 html_hidden("qt", ctx.qry.grep); 584 html_hidden("qt", ctx.qry.grep);
577 if (ctx.qry.search) 585 if (ctx.qry.search)
578 html_hidden("q", ctx.qry.search); 586 html_hidden("q", ctx.qry.search);
579 } 587 }
580} 588}
581 589
582char *hc(struct cgit_cmd *cmd, const char *page) 590char *hc(struct cgit_cmd *cmd, const char *page)
583{ 591{
584 return (strcmp(cmd->name, page) ? NULL : "active"); 592 return (strcmp(cmd->name, page) ? NULL : "active");
585} 593}
586 594
587void cgit_print_pageheader(struct cgit_context *ctx) 595void cgit_print_pageheader(struct cgit_context *ctx)
588{ 596{
@@ -623,33 +631,33 @@ void cgit_print_pageheader(struct cgit_context *ctx)
623 html_txt(ctx->repo->owner); 631 html_txt(ctx->repo->owner);
624 } else { 632 } else {
625 if (ctx->cfg.root_desc) 633 if (ctx->cfg.root_desc)
626 html_txt(ctx->cfg.root_desc); 634 html_txt(ctx->cfg.root_desc);
627 else if (ctx->cfg.index_info) 635 else if (ctx->cfg.index_info)
628 html_include(ctx->cfg.index_info); 636 html_include(ctx->cfg.index_info);
629 } 637 }
630 html("</td></tr></table>\n"); 638 html("</td></tr></table>\n");
631 639
632 html("<table class='tabs'><tr><td>\n"); 640 html("<table class='tabs'><tr><td>\n");
633 if (ctx->repo) { 641 if (ctx->repo) {
634 cgit_summary_link("summary", NULL, hc(cmd, "summary"), 642 cgit_summary_link("summary", NULL, hc(cmd, "summary"),
635 ctx->qry.head); 643 ctx->qry.head);
636 cgit_refs_link("refs", NULL, hc(cmd, "refs"), ctx->qry.head, 644 cgit_refs_link("refs", NULL, hc(cmd, "refs"), ctx->qry.head,
637 ctx->qry.sha1, NULL); 645 ctx->qry.sha1, NULL);
638 cgit_log_link("log", NULL, hc(cmd, "log"), ctx->qry.head, 646 cgit_log_link("log", NULL, hc(cmd, "log"), ctx->qry.head,
639 NULL, NULL, 0, NULL, NULL); 647 NULL, NULL, 0, NULL, NULL, ctx->qry.showmsg);
640 cgit_tree_link("tree", NULL, hc(cmd, "tree"), ctx->qry.head, 648 cgit_tree_link("tree", NULL, hc(cmd, "tree"), ctx->qry.head,
641 ctx->qry.sha1, NULL); 649 ctx->qry.sha1, NULL);
642 cgit_commit_link("commit", NULL, hc(cmd, "commit"), 650 cgit_commit_link("commit", NULL, hc(cmd, "commit"),
643 ctx->qry.head, ctx->qry.sha1); 651 ctx->qry.head, ctx->qry.sha1);
644 cgit_diff_link("diff", NULL, hc(cmd, "diff"), ctx->qry.head, 652 cgit_diff_link("diff", NULL, hc(cmd, "diff"), ctx->qry.head,
645 ctx->qry.sha1, ctx->qry.sha2, NULL); 653 ctx->qry.sha1, ctx->qry.sha2, NULL);
646 if (ctx->repo->readme) 654 if (ctx->repo->readme)
647 reporevlink("about", "about", NULL, 655 reporevlink("about", "about", NULL,
648 hc(cmd, "about"), ctx->qry.head, NULL, 656 hc(cmd, "about"), ctx->qry.head, NULL,
649 NULL); 657 NULL);
650 html("</td><td class='form'>"); 658 html("</td><td class='form'>");
651 html("<form class='right' method='get' action='"); 659 html("<form class='right' method='get' action='");
652 if (ctx->cfg.virtual_root) 660 if (ctx->cfg.virtual_root)
653 html_url_path(cgit_fileurl(ctx->qry.repo, "log", 661 html_url_path(cgit_fileurl(ctx->qry.repo, "log",
654 ctx->qry.path, NULL)); 662 ctx->qry.path, NULL));
655 html("'>\n"); 663 html("'>\n");
diff --git a/ui-shared.h b/ui-shared.h
index 3c8a6d0..2ab53ae 100644
--- a/ui-shared.h
+++ b/ui-shared.h
@@ -6,33 +6,33 @@ extern char *cgit_repourl(const char *reponame);
6extern char *cgit_fileurl(const char *reponame, const char *pagename, 6extern char *cgit_fileurl(const char *reponame, const char *pagename,
7 const char *filename, const char *query); 7 const char *filename, const char *query);
8extern char *cgit_pageurl(const char *reponame, const char *pagename, 8extern char *cgit_pageurl(const char *reponame, const char *pagename,
9 const char *query); 9 const char *query);
10 10
11extern void cgit_index_link(char *name, char *title, char *class, 11extern void cgit_index_link(char *name, char *title, char *class,
12 char *pattern, int ofs); 12 char *pattern, int ofs);
13extern void cgit_summary_link(char *name, char *title, char *class, char *head); 13extern void cgit_summary_link(char *name, char *title, char *class, char *head);
14extern void cgit_tag_link(char *name, char *title, char *class, char *head, 14extern void cgit_tag_link(char *name, char *title, char *class, char *head,
15 char *rev); 15 char *rev);
16extern void cgit_tree_link(char *name, char *title, char *class, char *head, 16extern void cgit_tree_link(char *name, char *title, char *class, char *head,
17 char *rev, char *path); 17 char *rev, char *path);
18extern void cgit_plain_link(char *name, char *title, char *class, char *head, 18extern void cgit_plain_link(char *name, char *title, char *class, char *head,
19 char *rev, char *path); 19 char *rev, char *path);
20extern void cgit_log_link(char *name, char *title, char *class, char *head, 20extern void cgit_log_link(char *name, char *title, char *class, char *head,
21 char *rev, char *path, int ofs, char *grep, 21 char *rev, char *path, int ofs, char *grep,
22 char *pattern); 22 char *pattern, int showmsg);
23extern void cgit_commit_link(char *name, char *title, char *class, char *head, 23extern void cgit_commit_link(char *name, char *title, char *class, char *head,
24 char *rev); 24 char *rev);
25extern void cgit_patch_link(char *name, char *title, char *class, char *head, 25extern void cgit_patch_link(char *name, char *title, char *class, char *head,
26 char *rev); 26 char *rev);
27extern void cgit_refs_link(char *name, char *title, char *class, char *head, 27extern void cgit_refs_link(char *name, char *title, char *class, char *head,
28 char *rev, char *path); 28 char *rev, char *path);
29extern void cgit_snapshot_link(char *name, char *title, char *class, 29extern void cgit_snapshot_link(char *name, char *title, char *class,
30 char *head, char *rev, char *archivename); 30 char *head, char *rev, char *archivename);
31extern void cgit_diff_link(char *name, char *title, char *class, char *head, 31extern void cgit_diff_link(char *name, char *title, char *class, char *head,
32 char *new_rev, char *old_rev, char *path); 32 char *new_rev, char *old_rev, char *path);
33extern void cgit_object_link(struct object *obj); 33extern void cgit_object_link(struct object *obj);
34 34
35extern void cgit_print_error(char *msg); 35extern void cgit_print_error(char *msg);
36extern void cgit_print_date(time_t secs, char *format, int local_time); 36extern void cgit_print_date(time_t secs, char *format, int local_time);
37extern void cgit_print_age(time_t t, time_t max_relative, char *format); 37extern void cgit_print_age(time_t t, time_t max_relative, char *format);
38extern void cgit_print_http_headers(struct cgit_context *ctx); 38extern void cgit_print_http_headers(struct cgit_context *ctx);
diff --git a/ui-tree.c b/ui-tree.c
index 79332fc..051db7c 100644
--- a/ui-tree.c
+++ b/ui-tree.c
@@ -93,33 +93,33 @@ static int ls_item(const unsigned char *sha1, const char *base, int baselen,
93 name, 93 name,
94 sha1_to_hex(sha1))); 94 sha1_to_hex(sha1)));
95 html("'>"); 95 html("'>");
96 html_txt(name); 96 html_txt(name);
97 html("</a>"); 97 html("</a>");
98 } else if (S_ISDIR(mode)) { 98 } else if (S_ISDIR(mode)) {
99 cgit_tree_link(name, NULL, "ls-dir", ctx.qry.head, 99 cgit_tree_link(name, NULL, "ls-dir", ctx.qry.head,
100 curr_rev, fullpath); 100 curr_rev, fullpath);
101 } else { 101 } else {
102 cgit_tree_link(name, NULL, "ls-blob", ctx.qry.head, 102 cgit_tree_link(name, NULL, "ls-blob", ctx.qry.head,
103 curr_rev, fullpath); 103 curr_rev, fullpath);
104 } 104 }
105 htmlf("</td><td class='ls-size'>%li</td>", size); 105 htmlf("</td><td class='ls-size'>%li</td>", size);
106 106
107 html("<td>"); 107 html("<td>");
108 cgit_log_link("log", NULL, "button", ctx.qry.head, curr_rev, 108 cgit_log_link("log", NULL, "button", ctx.qry.head, curr_rev,
109 fullpath, 0, NULL, NULL); 109 fullpath, 0, NULL, NULL, ctx.qry.showmsg);
110 html("</td></tr>\n"); 110 html("</td></tr>\n");
111 free(name); 111 free(name);
112 return 0; 112 return 0;
113} 113}
114 114
115static void ls_head() 115static void ls_head()
116{ 116{
117 html("<table summary='tree listing' class='list'>\n"); 117 html("<table summary='tree listing' class='list'>\n");
118 html("<tr class='nohover'>"); 118 html("<tr class='nohover'>");
119 html("<th class='left'>Mode</th>"); 119 html("<th class='left'>Mode</th>");
120 html("<th class='left'>Name</th>"); 120 html("<th class='left'>Name</th>");
121 html("<th class='right'>Size</th>"); 121 html("<th class='right'>Size</th>");
122 html("<th/>"); 122 html("<th/>");
123 html("</tr>\n"); 123 html("</tr>\n");
124 header = 1; 124 header = 1;
125} 125}