about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--cmd.c2
-rw-r--r--ui-diff.c19
2 files changed, 15 insertions, 6 deletions
diff --git a/cmd.c b/cmd.c index 1b42a47..d9f6eff 100644 --- a/cmd.c +++ b/cmd.c
@@ -158,7 +158,7 @@ struct cgit_cmd *cgit_get_cmd(void)
158 def_cmp(about, 0, 0, 0, 0), 158 def_cmp(about, 0, 0, 0, 0),
159 def_cmd(blob, 1, 0, 0, 0), 159 def_cmd(blob, 1, 0, 0, 0),
160 def_cmd(commit, 1, 0, 1, 0), 160 def_cmd(commit, 1, 0, 1, 0),
161 def_cmd(diff, 1, 1, 1, 0), 161 def_cmd(diff, 1, 0, 1, 0),
162 def_cmd(info, 1, 0, 0, 1), 162 def_cmd(info, 1, 0, 0, 1),
163 def_cmd(log, 1, 1, 1, 0), 163 def_cmd(log, 1, 1, 1, 0),
164 def_cmd(ls_cache, 0, 0, 0, 0), 164 def_cmd(ls_cache, 0, 0, 0, 0),
diff --git a/ui-diff.c b/ui-diff.c index caebd5d..5d18296 100644 --- a/ui-diff.c +++ b/ui-diff.c
@@ -403,19 +403,22 @@ void cgit_print_diff(const char *new_rev, const char *old_rev,
403 if (!new_rev) 403 if (!new_rev)
404 new_rev = ctx.qry.head; 404 new_rev = ctx.qry.head;
405 if (get_sha1(new_rev, new_rev_sha1)) { 405 if (get_sha1(new_rev, new_rev_sha1)) {
406 cgit_print_error("Bad object name: %s", new_rev); 406 cgit_print_error_page(404, "Not found",
407 "Bad object name: %s", new_rev);
407 return; 408 return;
408 } 409 }
409 commit = lookup_commit_reference(new_rev_sha1); 410 commit = lookup_commit_reference(new_rev_sha1);
410 if (!commit || parse_commit(commit)) { 411 if (!commit || parse_commit(commit)) {
411 cgit_print_error("Bad commit: %s", sha1_to_hex(new_rev_sha1)); 412 cgit_print_error_page(404, "Not found",
413 "Bad commit: %s", sha1_to_hex(new_rev_sha1));
412 return; 414 return;
413 } 415 }
414 new_tree_sha1 = commit->tree->object.sha1; 416 new_tree_sha1 = commit->tree->object.sha1;
415 417
416 if (old_rev) { 418 if (old_rev) {
417 if (get_sha1(old_rev, old_rev_sha1)) { 419 if (get_sha1(old_rev, old_rev_sha1)) {
418 cgit_print_error("Bad object name: %s", old_rev); 420 cgit_print_error_page(404, "Not found",
421 "Bad object name: %s", old_rev);
419 return; 422 return;
420 } 423 }
421 } else if (commit->parents && commit->parents->item) { 424 } else if (commit->parents && commit->parents->item) {
@@ -427,7 +430,8 @@ void cgit_print_diff(const char *new_rev, const char *old_rev,
427 if (!is_null_sha1(old_rev_sha1)) { 430 if (!is_null_sha1(old_rev_sha1)) {
428 commit2 = lookup_commit_reference(old_rev_sha1); 431 commit2 = lookup_commit_reference(old_rev_sha1);
429 if (!commit2 || parse_commit(commit2)) { 432 if (!commit2 || parse_commit(commit2)) {
430 cgit_print_error("Bad commit: %s", sha1_to_hex(old_rev_sha1)); 433 cgit_print_error_page(404, "Not found",
434 "Bad commit: %s", sha1_to_hex(old_rev_sha1));
431 return; 435 return;
432 } 436 }
433 old_tree_sha1 = commit2->tree->object.sha1; 437 old_tree_sha1 = commit2->tree->object.sha1;
@@ -460,8 +464,10 @@ void cgit_print_diff(const char *new_rev, const char *old_rev,
460 difftype = ctx.qry.has_difftype ? ctx.qry.difftype : ctx.cfg.difftype; 464 difftype = ctx.qry.has_difftype ? ctx.qry.difftype : ctx.cfg.difftype;
461 use_ssdiff = difftype == DIFF_SSDIFF; 465 use_ssdiff = difftype == DIFF_SSDIFF;
462 466
463 if (show_ctrls) 467 if (show_ctrls) {
468 cgit_print_layout_start();
464 cgit_print_diff_ctrls(); 469 cgit_print_diff_ctrls();
470 }
465 471
466 /* 472 /*
467 * Clicking on a link to a file in the diff stat should show a diff 473 * Clicking on a link to a file in the diff stat should show a diff
@@ -489,4 +495,7 @@ void cgit_print_diff(const char *new_rev, const char *old_rev,
489 if (!use_ssdiff) 495 if (!use_ssdiff)
490 html("</td></tr>"); 496 html("</td></tr>");
491 html("</table>"); 497 html("</table>");
498
499 if (show_ctrls)
500 cgit_print_layout_end();
492} 501}