author | Johan Herland <johan@herland.net> | 2010-06-10 18:15:51 (UTC) |
---|---|---|
committer | Lars Hjemli <hjemli@gmail.com> | 2010-06-19 11:00:07 (UTC) |
commit | d20313e3daf855ee5d4808e050f54614c200d7b1 (patch) (unidiff) | |
tree | 5c462f3ba6ec97c0b099a309dfd0fa87d03fbc72 | |
parent | 6180e6169d6e87a3bea7e4da835dca17f93e5cfd (diff) | |
download | cgit-d20313e3daf855ee5d4808e050f54614c200d7b1.zip cgit-d20313e3daf855ee5d4808e050f54614c200d7b1.tar.gz cgit-d20313e3daf855ee5d4808e050f54614c200d7b1.tar.bz2 |
ui-diff: Add links to increase/decrease number of context lines in diffs
Add two links to the "Diffstat" line to show more/less context lines in the
generated diff.
To support this, cgit_commit_link() and cgit_diff_link() has learned to
preserve the ctx.qry.context variable.
Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
-rw-r--r-- | ui-diff.c | 10 | ||||
-rw-r--r-- | ui-shared.c | 14 |
2 files changed, 23 insertions, 1 deletions
@@ -95,135 +95,143 @@ static void print_fileinfo(struct fileinfo *info) | |||
95 | htmlf("bin</td><td class='graph'>%d -> %d bytes", | 95 | htmlf("bin</td><td class='graph'>%d -> %d bytes", |
96 | info->old_size, info->new_size); | 96 | info->old_size, info->new_size); |
97 | return; | 97 | return; |
98 | } | 98 | } |
99 | htmlf("%d", info->added + info->removed); | 99 | htmlf("%d", info->added + info->removed); |
100 | html("</td><td class='graph'>"); | 100 | html("</td><td class='graph'>"); |
101 | htmlf("<table summary='file diffstat' width='%d%%'><tr>", (max_changes > 100 ? 100 : max_changes)); | 101 | htmlf("<table summary='file diffstat' width='%d%%'><tr>", (max_changes > 100 ? 100 : max_changes)); |
102 | htmlf("<td class='add' style='width: %.1f%%;'/>", | 102 | htmlf("<td class='add' style='width: %.1f%%;'/>", |
103 | info->added * 100.0 / max_changes); | 103 | info->added * 100.0 / max_changes); |
104 | htmlf("<td class='rem' style='width: %.1f%%;'/>", | 104 | htmlf("<td class='rem' style='width: %.1f%%;'/>", |
105 | info->removed * 100.0 / max_changes); | 105 | info->removed * 100.0 / max_changes); |
106 | htmlf("<td class='none' style='width: %.1f%%;'/>", | 106 | htmlf("<td class='none' style='width: %.1f%%;'/>", |
107 | (max_changes - info->removed - info->added) * 100.0 / max_changes); | 107 | (max_changes - info->removed - info->added) * 100.0 / max_changes); |
108 | html("</tr></table></td></tr>\n"); | 108 | html("</tr></table></td></tr>\n"); |
109 | } | 109 | } |
110 | 110 | ||
111 | static void count_diff_lines(char *line, int len) | 111 | static void count_diff_lines(char *line, int len) |
112 | { | 112 | { |
113 | if (line && (len > 0)) { | 113 | if (line && (len > 0)) { |
114 | if (line[0] == '+') | 114 | if (line[0] == '+') |
115 | lines_added++; | 115 | lines_added++; |
116 | else if (line[0] == '-') | 116 | else if (line[0] == '-') |
117 | lines_removed++; | 117 | lines_removed++; |
118 | } | 118 | } |
119 | } | 119 | } |
120 | 120 | ||
121 | static void inspect_filepair(struct diff_filepair *pair) | 121 | static void inspect_filepair(struct diff_filepair *pair) |
122 | { | 122 | { |
123 | int binary = 0; | 123 | int binary = 0; |
124 | unsigned long old_size = 0; | 124 | unsigned long old_size = 0; |
125 | unsigned long new_size = 0; | 125 | unsigned long new_size = 0; |
126 | files++; | 126 | files++; |
127 | lines_added = 0; | 127 | lines_added = 0; |
128 | lines_removed = 0; | 128 | lines_removed = 0; |
129 | cgit_diff_files(pair->one->sha1, pair->two->sha1, &old_size, &new_size, | 129 | cgit_diff_files(pair->one->sha1, pair->two->sha1, &old_size, &new_size, |
130 | &binary, 0, count_diff_lines); | 130 | &binary, 0, count_diff_lines); |
131 | if (files >= slots) { | 131 | if (files >= slots) { |
132 | if (slots == 0) | 132 | if (slots == 0) |
133 | slots = 4; | 133 | slots = 4; |
134 | else | 134 | else |
135 | slots = slots * 2; | 135 | slots = slots * 2; |
136 | items = xrealloc(items, slots * sizeof(struct fileinfo)); | 136 | items = xrealloc(items, slots * sizeof(struct fileinfo)); |
137 | } | 137 | } |
138 | items[files-1].status = pair->status; | 138 | items[files-1].status = pair->status; |
139 | hashcpy(items[files-1].old_sha1, pair->one->sha1); | 139 | hashcpy(items[files-1].old_sha1, pair->one->sha1); |
140 | hashcpy(items[files-1].new_sha1, pair->two->sha1); | 140 | hashcpy(items[files-1].new_sha1, pair->two->sha1); |
141 | items[files-1].old_mode = pair->one->mode; | 141 | items[files-1].old_mode = pair->one->mode; |
142 | items[files-1].new_mode = pair->two->mode; | 142 | items[files-1].new_mode = pair->two->mode; |
143 | items[files-1].old_path = xstrdup(pair->one->path); | 143 | items[files-1].old_path = xstrdup(pair->one->path); |
144 | items[files-1].new_path = xstrdup(pair->two->path); | 144 | items[files-1].new_path = xstrdup(pair->two->path); |
145 | items[files-1].added = lines_added; | 145 | items[files-1].added = lines_added; |
146 | items[files-1].removed = lines_removed; | 146 | items[files-1].removed = lines_removed; |
147 | items[files-1].old_size = old_size; | 147 | items[files-1].old_size = old_size; |
148 | items[files-1].new_size = new_size; | 148 | items[files-1].new_size = new_size; |
149 | items[files-1].binary = binary; | 149 | items[files-1].binary = binary; |
150 | if (lines_added + lines_removed > max_changes) | 150 | if (lines_added + lines_removed > max_changes) |
151 | max_changes = lines_added + lines_removed; | 151 | max_changes = lines_added + lines_removed; |
152 | total_adds += lines_added; | 152 | total_adds += lines_added; |
153 | total_rems += lines_removed; | 153 | total_rems += lines_removed; |
154 | } | 154 | } |
155 | 155 | ||
156 | void cgit_print_diffstat(const unsigned char *old_sha1, | 156 | void cgit_print_diffstat(const unsigned char *old_sha1, |
157 | const unsigned char *new_sha1, const char *prefix) | 157 | const unsigned char *new_sha1, const char *prefix) |
158 | { | 158 | { |
159 | int i; | 159 | int i, save_context = ctx.qry.context; |
160 | 160 | ||
161 | html("<div class='diffstat-header'>"); | 161 | html("<div class='diffstat-header'>"); |
162 | cgit_diff_link("Diffstat", NULL, NULL, ctx.qry.head, ctx.qry.sha1, | 162 | cgit_diff_link("Diffstat", NULL, NULL, ctx.qry.head, ctx.qry.sha1, |
163 | ctx.qry.sha2, NULL, 0); | 163 | ctx.qry.sha2, NULL, 0); |
164 | if (prefix) | 164 | if (prefix) |
165 | htmlf(" (limited to '%s')", prefix); | 165 | htmlf(" (limited to '%s')", prefix); |
166 | html(" ("); | ||
167 | ctx.qry.context = (save_context > 0 ? save_context : 3) << 1; | ||
168 | cgit_self_link("more", NULL, NULL, &ctx); | ||
169 | html("/"); | ||
170 | ctx.qry.context = (save_context > 3 ? save_context : 3) >> 1; | ||
171 | cgit_self_link("less", NULL, NULL, &ctx); | ||
172 | ctx.qry.context = save_context; | ||
173 | html(" context)"); | ||
166 | html("</div>"); | 174 | html("</div>"); |
167 | html("<table summary='diffstat' class='diffstat'>"); | 175 | html("<table summary='diffstat' class='diffstat'>"); |
168 | max_changes = 0; | 176 | max_changes = 0; |
169 | cgit_diff_tree(old_sha1, new_sha1, inspect_filepair, prefix); | 177 | cgit_diff_tree(old_sha1, new_sha1, inspect_filepair, prefix); |
170 | for(i = 0; i<files; i++) | 178 | for(i = 0; i<files; i++) |
171 | print_fileinfo(&items[i]); | 179 | print_fileinfo(&items[i]); |
172 | html("</table>"); | 180 | html("</table>"); |
173 | html("<div class='diffstat-summary'>"); | 181 | html("<div class='diffstat-summary'>"); |
174 | htmlf("%d files changed, %d insertions, %d deletions", | 182 | htmlf("%d files changed, %d insertions, %d deletions", |
175 | files, total_adds, total_rems); | 183 | files, total_adds, total_rems); |
176 | html("</div>"); | 184 | html("</div>"); |
177 | } | 185 | } |
178 | 186 | ||
179 | 187 | ||
180 | /* | 188 | /* |
181 | * print a single line returned from xdiff | 189 | * print a single line returned from xdiff |
182 | */ | 190 | */ |
183 | static void print_line(char *line, int len) | 191 | static void print_line(char *line, int len) |
184 | { | 192 | { |
185 | char *class = "ctx"; | 193 | char *class = "ctx"; |
186 | char c = line[len-1]; | 194 | char c = line[len-1]; |
187 | 195 | ||
188 | if (line[0] == '+') | 196 | if (line[0] == '+') |
189 | class = "add"; | 197 | class = "add"; |
190 | else if (line[0] == '-') | 198 | else if (line[0] == '-') |
191 | class = "del"; | 199 | class = "del"; |
192 | else if (line[0] == '@') | 200 | else if (line[0] == '@') |
193 | class = "hunk"; | 201 | class = "hunk"; |
194 | 202 | ||
195 | htmlf("<div class='%s'>", class); | 203 | htmlf("<div class='%s'>", class); |
196 | line[len-1] = '\0'; | 204 | line[len-1] = '\0'; |
197 | html_txt(line); | 205 | html_txt(line); |
198 | html("</div>"); | 206 | html("</div>"); |
199 | line[len-1] = c; | 207 | line[len-1] = c; |
200 | } | 208 | } |
201 | 209 | ||
202 | static void header(unsigned char *sha1, char *path1, int mode1, | 210 | static void header(unsigned char *sha1, char *path1, int mode1, |
203 | unsigned char *sha2, char *path2, int mode2) | 211 | unsigned char *sha2, char *path2, int mode2) |
204 | { | 212 | { |
205 | char *abbrev1, *abbrev2; | 213 | char *abbrev1, *abbrev2; |
206 | int subproject; | 214 | int subproject; |
207 | 215 | ||
208 | subproject = (S_ISGITLINK(mode1) || S_ISGITLINK(mode2)); | 216 | subproject = (S_ISGITLINK(mode1) || S_ISGITLINK(mode2)); |
209 | html("<div class='head'>"); | 217 | html("<div class='head'>"); |
210 | html("diff --git a/"); | 218 | html("diff --git a/"); |
211 | html_txt(path1); | 219 | html_txt(path1); |
212 | html(" b/"); | 220 | html(" b/"); |
213 | html_txt(path2); | 221 | html_txt(path2); |
214 | 222 | ||
215 | if (is_null_sha1(sha1)) | 223 | if (is_null_sha1(sha1)) |
216 | path1 = "dev/null"; | 224 | path1 = "dev/null"; |
217 | if (is_null_sha1(sha2)) | 225 | if (is_null_sha1(sha2)) |
218 | path2 = "dev/null"; | 226 | path2 = "dev/null"; |
219 | 227 | ||
220 | if (mode1 == 0) | 228 | if (mode1 == 0) |
221 | htmlf("<br/>new file mode %.6o", mode2); | 229 | htmlf("<br/>new file mode %.6o", mode2); |
222 | 230 | ||
223 | if (mode2 == 0) | 231 | if (mode2 == 0) |
224 | htmlf("<br/>deleted file mode %.6o", mode1); | 232 | htmlf("<br/>deleted file mode %.6o", mode1); |
225 | 233 | ||
226 | if (!subproject) { | 234 | if (!subproject) { |
227 | abbrev1 = xstrdup(find_unique_abbrev(sha1, DEFAULT_ABBREV)); | 235 | abbrev1 = xstrdup(find_unique_abbrev(sha1, DEFAULT_ABBREV)); |
228 | abbrev2 = xstrdup(find_unique_abbrev(sha2, DEFAULT_ABBREV)); | 236 | abbrev2 = xstrdup(find_unique_abbrev(sha2, DEFAULT_ABBREV)); |
229 | htmlf("<br/>index %s..%s", abbrev1, abbrev2); | 237 | htmlf("<br/>index %s..%s", abbrev1, abbrev2); |
diff --git a/ui-shared.c b/ui-shared.c index e991799..c99bcec 100644 --- a/ui-shared.c +++ b/ui-shared.c | |||
@@ -280,169 +280,183 @@ void cgit_plain_link(const char *name, const char *title, const char *class, | |||
280 | { | 280 | { |
281 | reporevlink("plain", name, title, class, head, rev, path); | 281 | reporevlink("plain", name, title, class, head, rev, path); |
282 | } | 282 | } |
283 | 283 | ||
284 | void cgit_log_link(const char *name, const char *title, const char *class, | 284 | void cgit_log_link(const char *name, const char *title, const char *class, |
285 | const char *head, const char *rev, const char *path, | 285 | const char *head, const char *rev, const char *path, |
286 | int ofs, const char *grep, const char *pattern, int showmsg) | 286 | int ofs, const char *grep, const char *pattern, int showmsg) |
287 | { | 287 | { |
288 | char *delim; | 288 | char *delim; |
289 | 289 | ||
290 | delim = repolink(title, class, "log", head, path); | 290 | delim = repolink(title, class, "log", head, path); |
291 | if (rev && strcmp(rev, ctx.qry.head)) { | 291 | if (rev && strcmp(rev, ctx.qry.head)) { |
292 | html(delim); | 292 | html(delim); |
293 | html("id="); | 293 | html("id="); |
294 | html_url_arg(rev); | 294 | html_url_arg(rev); |
295 | delim = "&"; | 295 | delim = "&"; |
296 | } | 296 | } |
297 | if (grep && pattern) { | 297 | if (grep && pattern) { |
298 | html(delim); | 298 | html(delim); |
299 | html("qt="); | 299 | html("qt="); |
300 | html_url_arg(grep); | 300 | html_url_arg(grep); |
301 | delim = "&"; | 301 | delim = "&"; |
302 | html(delim); | 302 | html(delim); |
303 | html("q="); | 303 | html("q="); |
304 | html_url_arg(pattern); | 304 | html_url_arg(pattern); |
305 | } | 305 | } |
306 | if (ofs > 0) { | 306 | if (ofs > 0) { |
307 | html(delim); | 307 | html(delim); |
308 | html("ofs="); | 308 | html("ofs="); |
309 | htmlf("%d", ofs); | 309 | htmlf("%d", ofs); |
310 | delim = "&"; | 310 | delim = "&"; |
311 | } | 311 | } |
312 | if (showmsg) { | 312 | if (showmsg) { |
313 | html(delim); | 313 | html(delim); |
314 | html("showmsg=1"); | 314 | html("showmsg=1"); |
315 | } | 315 | } |
316 | html("'>"); | 316 | html("'>"); |
317 | html_txt(name); | 317 | html_txt(name); |
318 | html("</a>"); | 318 | html("</a>"); |
319 | } | 319 | } |
320 | 320 | ||
321 | void cgit_commit_link(char *name, const char *title, const char *class, | 321 | void cgit_commit_link(char *name, const char *title, const char *class, |
322 | const char *head, const char *rev, const char *path, | 322 | const char *head, const char *rev, const char *path, |
323 | int toggle_ssdiff) | 323 | int toggle_ssdiff) |
324 | { | 324 | { |
325 | if (strlen(name) > ctx.cfg.max_msg_len && ctx.cfg.max_msg_len >= 15) { | 325 | if (strlen(name) > ctx.cfg.max_msg_len && ctx.cfg.max_msg_len >= 15) { |
326 | name[ctx.cfg.max_msg_len] = '\0'; | 326 | name[ctx.cfg.max_msg_len] = '\0'; |
327 | name[ctx.cfg.max_msg_len - 1] = '.'; | 327 | name[ctx.cfg.max_msg_len - 1] = '.'; |
328 | name[ctx.cfg.max_msg_len - 2] = '.'; | 328 | name[ctx.cfg.max_msg_len - 2] = '.'; |
329 | name[ctx.cfg.max_msg_len - 3] = '.'; | 329 | name[ctx.cfg.max_msg_len - 3] = '.'; |
330 | } | 330 | } |
331 | 331 | ||
332 | char *delim; | 332 | char *delim; |
333 | 333 | ||
334 | delim = repolink(title, class, "commit", head, path); | 334 | delim = repolink(title, class, "commit", head, path); |
335 | if (rev && strcmp(rev, ctx.qry.head)) { | 335 | if (rev && strcmp(rev, ctx.qry.head)) { |
336 | html(delim); | 336 | html(delim); |
337 | html("id="); | 337 | html("id="); |
338 | html_url_arg(rev); | 338 | html_url_arg(rev); |
339 | delim = "&"; | 339 | delim = "&"; |
340 | } | 340 | } |
341 | if ((ctx.qry.ssdiff && !toggle_ssdiff) || (!ctx.qry.ssdiff && toggle_ssdiff)) { | 341 | if ((ctx.qry.ssdiff && !toggle_ssdiff) || (!ctx.qry.ssdiff && toggle_ssdiff)) { |
342 | html(delim); | 342 | html(delim); |
343 | html("ss=1"); | 343 | html("ss=1"); |
344 | delim = "&"; | ||
345 | } | ||
346 | if (ctx.qry.context > 0 && ctx.qry.context != 3) { | ||
347 | html(delim); | ||
348 | html("context="); | ||
349 | htmlf("%d", ctx.qry.context); | ||
350 | delim = "&"; | ||
344 | } | 351 | } |
345 | html("'>"); | 352 | html("'>"); |
346 | html_txt(name); | 353 | html_txt(name); |
347 | html("</a>"); | 354 | html("</a>"); |
348 | } | 355 | } |
349 | 356 | ||
350 | void cgit_refs_link(const char *name, const char *title, const char *class, | 357 | void cgit_refs_link(const char *name, const char *title, const char *class, |
351 | const char *head, const char *rev, const char *path) | 358 | const char *head, const char *rev, const char *path) |
352 | { | 359 | { |
353 | reporevlink("refs", name, title, class, head, rev, path); | 360 | reporevlink("refs", name, title, class, head, rev, path); |
354 | } | 361 | } |
355 | 362 | ||
356 | void cgit_snapshot_link(const char *name, const char *title, const char *class, | 363 | void cgit_snapshot_link(const char *name, const char *title, const char *class, |
357 | const char *head, const char *rev, | 364 | const char *head, const char *rev, |
358 | const char *archivename) | 365 | const char *archivename) |
359 | { | 366 | { |
360 | reporevlink("snapshot", name, title, class, head, rev, archivename); | 367 | reporevlink("snapshot", name, title, class, head, rev, archivename); |
361 | } | 368 | } |
362 | 369 | ||
363 | void cgit_diff_link(const char *name, const char *title, const char *class, | 370 | void cgit_diff_link(const char *name, const char *title, const char *class, |
364 | const char *head, const char *new_rev, const char *old_rev, | 371 | const char *head, const char *new_rev, const char *old_rev, |
365 | const char *path, int toggle_ssdiff) | 372 | const char *path, int toggle_ssdiff) |
366 | { | 373 | { |
367 | char *delim; | 374 | char *delim; |
368 | 375 | ||
369 | delim = repolink(title, class, "diff", head, path); | 376 | delim = repolink(title, class, "diff", head, path); |
370 | if (new_rev && ctx.qry.head != NULL && strcmp(new_rev, ctx.qry.head)) { | 377 | if (new_rev && ctx.qry.head != NULL && strcmp(new_rev, ctx.qry.head)) { |
371 | html(delim); | 378 | html(delim); |
372 | html("id="); | 379 | html("id="); |
373 | html_url_arg(new_rev); | 380 | html_url_arg(new_rev); |
374 | delim = "&"; | 381 | delim = "&"; |
375 | } | 382 | } |
376 | if (old_rev) { | 383 | if (old_rev) { |
377 | html(delim); | 384 | html(delim); |
378 | html("id2="); | 385 | html("id2="); |
379 | html_url_arg(old_rev); | 386 | html_url_arg(old_rev); |
380 | delim = "&"; | 387 | delim = "&"; |
381 | } | 388 | } |
382 | if ((ctx.qry.ssdiff && !toggle_ssdiff) || (!ctx.qry.ssdiff && toggle_ssdiff)) { | 389 | if ((ctx.qry.ssdiff && !toggle_ssdiff) || (!ctx.qry.ssdiff && toggle_ssdiff)) { |
383 | html(delim); | 390 | html(delim); |
384 | html("ss=1"); | 391 | html("ss=1"); |
392 | delim = "&"; | ||
393 | } | ||
394 | if (ctx.qry.context > 0 && ctx.qry.context != 3) { | ||
395 | html(delim); | ||
396 | html("context="); | ||
397 | htmlf("%d", ctx.qry.context); | ||
398 | delim = "&"; | ||
385 | } | 399 | } |
386 | html("'>"); | 400 | html("'>"); |
387 | html_txt(name); | 401 | html_txt(name); |
388 | html("</a>"); | 402 | html("</a>"); |
389 | } | 403 | } |
390 | 404 | ||
391 | void cgit_patch_link(const char *name, const char *title, const char *class, | 405 | void cgit_patch_link(const char *name, const char *title, const char *class, |
392 | const char *head, const char *rev, const char *path) | 406 | const char *head, const char *rev, const char *path) |
393 | { | 407 | { |
394 | reporevlink("patch", name, title, class, head, rev, path); | 408 | reporevlink("patch", name, title, class, head, rev, path); |
395 | } | 409 | } |
396 | 410 | ||
397 | void cgit_stats_link(const char *name, const char *title, const char *class, | 411 | void cgit_stats_link(const char *name, const char *title, const char *class, |
398 | const char *head, const char *path) | 412 | const char *head, const char *path) |
399 | { | 413 | { |
400 | reporevlink("stats", name, title, class, head, NULL, path); | 414 | reporevlink("stats", name, title, class, head, NULL, path); |
401 | } | 415 | } |
402 | 416 | ||
403 | void cgit_self_link(char *name, const char *title, const char *class, | 417 | void cgit_self_link(char *name, const char *title, const char *class, |
404 | struct cgit_context *ctx) | 418 | struct cgit_context *ctx) |
405 | { | 419 | { |
406 | if (!strcmp(ctx->qry.page, "repolist")) | 420 | if (!strcmp(ctx->qry.page, "repolist")) |
407 | return cgit_index_link(name, title, class, ctx->qry.search, | 421 | return cgit_index_link(name, title, class, ctx->qry.search, |
408 | ctx->qry.ofs); | 422 | ctx->qry.ofs); |
409 | else if (!strcmp(ctx->qry.page, "summary")) | 423 | else if (!strcmp(ctx->qry.page, "summary")) |
410 | return cgit_summary_link(name, title, class, ctx->qry.head); | 424 | return cgit_summary_link(name, title, class, ctx->qry.head); |
411 | else if (!strcmp(ctx->qry.page, "tag")) | 425 | else if (!strcmp(ctx->qry.page, "tag")) |
412 | return cgit_tag_link(name, title, class, ctx->qry.head, | 426 | return cgit_tag_link(name, title, class, ctx->qry.head, |
413 | ctx->qry.has_sha1 ? ctx->qry.sha1 : NULL); | 427 | ctx->qry.has_sha1 ? ctx->qry.sha1 : NULL); |
414 | else if (!strcmp(ctx->qry.page, "tree")) | 428 | else if (!strcmp(ctx->qry.page, "tree")) |
415 | return cgit_tree_link(name, title, class, ctx->qry.head, | 429 | return cgit_tree_link(name, title, class, ctx->qry.head, |
416 | ctx->qry.has_sha1 ? ctx->qry.sha1 : NULL, | 430 | ctx->qry.has_sha1 ? ctx->qry.sha1 : NULL, |
417 | ctx->qry.path); | 431 | ctx->qry.path); |
418 | else if (!strcmp(ctx->qry.page, "plain")) | 432 | else if (!strcmp(ctx->qry.page, "plain")) |
419 | return cgit_plain_link(name, title, class, ctx->qry.head, | 433 | return cgit_plain_link(name, title, class, ctx->qry.head, |
420 | ctx->qry.has_sha1 ? ctx->qry.sha1 : NULL, | 434 | ctx->qry.has_sha1 ? ctx->qry.sha1 : NULL, |
421 | ctx->qry.path); | 435 | ctx->qry.path); |
422 | else if (!strcmp(ctx->qry.page, "log")) | 436 | else if (!strcmp(ctx->qry.page, "log")) |
423 | return cgit_log_link(name, title, class, ctx->qry.head, | 437 | return cgit_log_link(name, title, class, ctx->qry.head, |
424 | ctx->qry.has_sha1 ? ctx->qry.sha1 : NULL, | 438 | ctx->qry.has_sha1 ? ctx->qry.sha1 : NULL, |
425 | ctx->qry.path, ctx->qry.ofs, | 439 | ctx->qry.path, ctx->qry.ofs, |
426 | ctx->qry.grep, ctx->qry.search, | 440 | ctx->qry.grep, ctx->qry.search, |
427 | ctx->qry.showmsg); | 441 | ctx->qry.showmsg); |
428 | else if (!strcmp(ctx->qry.page, "commit")) | 442 | else if (!strcmp(ctx->qry.page, "commit")) |
429 | return cgit_commit_link(name, title, class, ctx->qry.head, | 443 | return cgit_commit_link(name, title, class, ctx->qry.head, |
430 | ctx->qry.has_sha1 ? ctx->qry.sha1 : NULL, | 444 | ctx->qry.has_sha1 ? ctx->qry.sha1 : NULL, |
431 | ctx->qry.path, 0); | 445 | ctx->qry.path, 0); |
432 | else if (!strcmp(ctx->qry.page, "patch")) | 446 | else if (!strcmp(ctx->qry.page, "patch")) |
433 | return cgit_patch_link(name, title, class, ctx->qry.head, | 447 | return cgit_patch_link(name, title, class, ctx->qry.head, |
434 | ctx->qry.has_sha1 ? ctx->qry.sha1 : NULL, | 448 | ctx->qry.has_sha1 ? ctx->qry.sha1 : NULL, |
435 | ctx->qry.path); | 449 | ctx->qry.path); |
436 | else if (!strcmp(ctx->qry.page, "refs")) | 450 | else if (!strcmp(ctx->qry.page, "refs")) |
437 | return cgit_refs_link(name, title, class, ctx->qry.head, | 451 | return cgit_refs_link(name, title, class, ctx->qry.head, |
438 | ctx->qry.has_sha1 ? ctx->qry.sha1 : NULL, | 452 | ctx->qry.has_sha1 ? ctx->qry.sha1 : NULL, |
439 | ctx->qry.path); | 453 | ctx->qry.path); |
440 | else if (!strcmp(ctx->qry.page, "snapshot")) | 454 | else if (!strcmp(ctx->qry.page, "snapshot")) |
441 | return cgit_snapshot_link(name, title, class, ctx->qry.head, | 455 | return cgit_snapshot_link(name, title, class, ctx->qry.head, |
442 | ctx->qry.has_sha1 ? ctx->qry.sha1 : NULL, | 456 | ctx->qry.has_sha1 ? ctx->qry.sha1 : NULL, |
443 | ctx->qry.path); | 457 | ctx->qry.path); |
444 | else if (!strcmp(ctx->qry.page, "diff")) | 458 | else if (!strcmp(ctx->qry.page, "diff")) |
445 | return cgit_diff_link(name, title, class, ctx->qry.head, | 459 | return cgit_diff_link(name, title, class, ctx->qry.head, |
446 | ctx->qry.sha1, ctx->qry.sha2, | 460 | ctx->qry.sha1, ctx->qry.sha2, |
447 | ctx->qry.path, 0); | 461 | ctx->qry.path, 0); |
448 | else if (!strcmp(ctx->qry.page, "stats")) | 462 | else if (!strcmp(ctx->qry.page, "stats")) |