author | Lars Hjemli <hjemli@gmail.com> | 2008-12-06 10:37:37 (UTC) |
---|---|---|
committer | Lars Hjemli <hjemli@gmail.com> | 2008-12-06 10:37:37 (UTC) |
commit | 3c32fe07717f27fc891b66ccd06057fb810d03ad (patch) (unidiff) | |
tree | 04897b3eac6432c43284e7da79161e47856d078b | |
parent | 9c8be943f72b6f1bda5a31ce401899c3dd734e98 (diff) | |
parent | ab67164d6217fcda5ef3e07aefa3dd6eee6b65a3 (diff) | |
download | cgit-3c32fe07717f27fc891b66ccd06057fb810d03ad.zip cgit-3c32fe07717f27fc891b66ccd06057fb810d03ad.tar.gz cgit-3c32fe07717f27fc891b66ccd06057fb810d03ad.tar.bz2 |
Merge branch 'full-log'
Conflicts:
cgit.c
cgit.h
-rw-r--r-- | cgit.c | 2 | ||||
-rw-r--r-- | cgit.css | 15 | ||||
-rw-r--r-- | cgit.h | 1 | ||||
-rw-r--r-- | ui-log.c | 35 | ||||
-rw-r--r-- | ui-refs.c | 3 | ||||
-rw-r--r-- | ui-repolist.c | 2 | ||||
-rw-r--r-- | ui-shared.c | 12 | ||||
-rw-r--r-- | ui-shared.h | 2 | ||||
-rw-r--r-- | ui-tree.c | 2 |
9 files changed, 61 insertions, 13 deletions
@@ -147,24 +147,26 @@ static void querystring_cb(const char *name, const char *value) | |||
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 | ||
162 | static void prepare_context(struct cgit_context *ctx) | 164 | static 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; |
@@ -111,47 +111,62 @@ div.content { | |||
111 | 111 | ||
112 | 112 | ||
113 | table.list { | 113 | table.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 | ||
119 | table.list tr { | 119 | table.list tr { |
120 | background: white; | 120 | background: white; |
121 | } | 121 | } |
122 | 122 | ||
123 | table.list tr.logheader { | ||
124 | background: #eee; | ||
125 | } | ||
126 | |||
123 | table.list tr:hover { | 127 | table.list tr:hover { |
124 | background: #eee; | 128 | background: #eee; |
125 | } | 129 | } |
126 | 130 | ||
127 | table.list tr.nohover:hover { | 131 | table.list tr.nohover:hover { |
128 | background: white; | 132 | background: white; |
129 | } | 133 | } |
130 | 134 | ||
131 | table.list th { | 135 | table.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 | ||
141 | table.list td { | 145 | table.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 | ||
150 | table.list td.logsubject { | ||
151 | font-family: monospace; | ||
152 | font-weight: bold; | ||
153 | } | ||
154 | |||
155 | table.list td.logmsg { | ||
156 | font-family: monospace; | ||
157 | white-space: pre; | ||
158 | padding: 1em 0em 2em 0em; | ||
159 | } | ||
160 | |||
146 | table.list td a { | 161 | table.list td a { |
147 | color: black; | 162 | color: black; |
148 | } | 163 | } |
149 | 164 | ||
150 | table.list td a:hover { | 165 | table.list td a:hover { |
151 | color: #00f; | 166 | color: #00f; |
152 | } | 167 | } |
153 | 168 | ||
154 | img { | 169 | img { |
155 | border: none; | 170 | border: none; |
156 | } | 171 | } |
157 | 172 | ||
@@ -114,24 +114,25 @@ struct cgit_query { | |||
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 | ||
128 | struct cgit_config { | 129 | struct 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; |
@@ -26,50 +26,64 @@ void count_lines(char *line, int size) | |||
26 | 26 | ||
27 | void inspect_files(struct diff_filepair *pair) | 27 | void 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 | ||
34 | void print_commit(struct commit *commit) | 34 | void 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 | ||
67 | static const char *disambiguate_ref(const char *ref) | 81 | static 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 | ||
@@ -104,26 +118,33 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern | |||
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; |
@@ -140,29 +161,29 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern | |||
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(" "); | 174 | html(" "); |
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 | } |
@@ -49,25 +49,26 @@ static int cmp_tag_age(const void *a, const void *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 | ||
53 | static int print_branch(struct refinfo *ref) | 53 | static 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 | } |
diff --git a/ui-repolist.c b/ui-repolist.c index 87196f0..2c13d50 100644 --- a/ui-repolist.c +++ b/ui-repolist.c | |||
@@ -248,25 +248,25 @@ void cgit_print_repolist() | |||
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 | } |
diff --git a/ui-shared.c b/ui-shared.c index 9319881..95dfeb4 100644 --- a/ui-shared.c +++ b/ui-shared.c | |||
@@ -272,48 +272,54 @@ void 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 | ||
277 | void cgit_plain_link(char *name, char *title, char *class, char *head, | 277 | void 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 | ||
283 | void cgit_log_link(char *name, char *title, char *class, char *head, | 283 | void 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 | ||
314 | void cgit_commit_link(char *name, char *title, char *class, char *head, | 320 | void 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] = '.'; |
@@ -561,24 +567,26 @@ void add_hidden_formfields(int incl_head, int incl_search, char *page) | |||
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 | ||
582 | char *hc(struct cgit_cmd *cmd, const char *page) | 590 | char *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"); |
@@ -627,25 +635,25 @@ void cgit_print_pageheader(struct cgit_context *ctx) | |||
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='"); |
diff --git a/ui-shared.h b/ui-shared.h index 3c8a6d0..2ab53ae 100644 --- a/ui-shared.h +++ b/ui-shared.h | |||
@@ -10,25 +10,25 @@ extern char *cgit_pageurl(const char *reponame, const char *pagename, | |||
10 | 10 | ||
11 | extern void cgit_index_link(char *name, char *title, char *class, | 11 | extern void cgit_index_link(char *name, char *title, char *class, |
12 | char *pattern, int ofs); | 12 | char *pattern, int ofs); |
13 | extern void cgit_summary_link(char *name, char *title, char *class, char *head); | 13 | extern void cgit_summary_link(char *name, char *title, char *class, char *head); |
14 | extern void cgit_tag_link(char *name, char *title, char *class, char *head, | 14 | extern void cgit_tag_link(char *name, char *title, char *class, char *head, |
15 | char *rev); | 15 | char *rev); |
16 | extern void cgit_tree_link(char *name, char *title, char *class, char *head, | 16 | extern void cgit_tree_link(char *name, char *title, char *class, char *head, |
17 | char *rev, char *path); | 17 | char *rev, char *path); |
18 | extern void cgit_plain_link(char *name, char *title, char *class, char *head, | 18 | extern void cgit_plain_link(char *name, char *title, char *class, char *head, |
19 | char *rev, char *path); | 19 | char *rev, char *path); |
20 | extern void cgit_log_link(char *name, char *title, char *class, char *head, | 20 | extern 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); |
23 | extern void cgit_commit_link(char *name, char *title, char *class, char *head, | 23 | extern void cgit_commit_link(char *name, char *title, char *class, char *head, |
24 | char *rev); | 24 | char *rev); |
25 | extern void cgit_patch_link(char *name, char *title, char *class, char *head, | 25 | extern void cgit_patch_link(char *name, char *title, char *class, char *head, |
26 | char *rev); | 26 | char *rev); |
27 | extern void cgit_refs_link(char *name, char *title, char *class, char *head, | 27 | extern void cgit_refs_link(char *name, char *title, char *class, char *head, |
28 | char *rev, char *path); | 28 | char *rev, char *path); |
29 | extern void cgit_snapshot_link(char *name, char *title, char *class, | 29 | extern void cgit_snapshot_link(char *name, char *title, char *class, |
30 | char *head, char *rev, char *archivename); | 30 | char *head, char *rev, char *archivename); |
31 | extern void cgit_diff_link(char *name, char *title, char *class, char *head, | 31 | extern 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); |
33 | extern void cgit_object_link(struct object *obj); | 33 | extern void cgit_object_link(struct object *obj); |
34 | 34 | ||
@@ -97,25 +97,25 @@ static int ls_item(const unsigned char *sha1, const char *base, int baselen, | |||
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 | ||
115 | static void ls_head() | 115 | static 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>"); |