diff options
author | John Keeping <john@keeping.me.uk> | 2015-08-14 12:47:14 +0100 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2015-08-14 15:46:51 +0200 |
commit | 3b220eb22ded98851ca9dee7c3c3e3b0fd02c49b (patch) | |
tree | 77573441ad15b57a4f62ecaac847461fd0e7e49f /ui-diff.c | |
parent | c53a15c77a6763b4d6fefb033923ba7493b884a2 (diff) | |
download | cgit-3b220eb22ded98851ca9dee7c3c3e3b0fd02c49b.tar.gz cgit-3b220eb22ded98851ca9dee7c3c3e3b0fd02c49b.tar.bz2 cgit-3b220eb22ded98851ca9dee7c3c3e3b0fd02c49b.zip |
diff: move layout to page function
The existing "show_ctrls" flag is used to control whether we are running
in an existing page or control the page ourselves.
Signed-off-by: John Keeping <john@keeping.me.uk>
Diffstat (limited to 'ui-diff.c')
-rw-r--r-- | ui-diff.c | 19 |
1 files changed, 14 insertions, 5 deletions
@@ -403,19 +403,22 @@ void cgit_print_diff(const char *new_rev, const char *old_rev, if (!new_rev) new_rev = ctx.qry.head; if (get_sha1(new_rev, new_rev_sha1)) { - cgit_print_error("Bad object name: %s", new_rev); + cgit_print_error_page(404, "Not found", + "Bad object name: %s", new_rev); return; } commit = lookup_commit_reference(new_rev_sha1); if (!commit || parse_commit(commit)) { - cgit_print_error("Bad commit: %s", sha1_to_hex(new_rev_sha1)); + cgit_print_error_page(404, "Not found", + "Bad commit: %s", sha1_to_hex(new_rev_sha1)); return; } new_tree_sha1 = commit->tree->object.sha1; if (old_rev) { if (get_sha1(old_rev, old_rev_sha1)) { - cgit_print_error("Bad object name: %s", old_rev); + cgit_print_error_page(404, "Not found", + "Bad object name: %s", old_rev); return; } } else if (commit->parents && commit->parents->item) { @@ -427,7 +430,8 @@ void cgit_print_diff(const char *new_rev, const char *old_rev, if (!is_null_sha1(old_rev_sha1)) { commit2 = lookup_commit_reference(old_rev_sha1); if (!commit2 || parse_commit(commit2)) { - cgit_print_error("Bad commit: %s", sha1_to_hex(old_rev_sha1)); + cgit_print_error_page(404, "Not found", + "Bad commit: %s", sha1_to_hex(old_rev_sha1)); return; } old_tree_sha1 = commit2->tree->object.sha1; @@ -460,8 +464,10 @@ void cgit_print_diff(const char *new_rev, const char *old_rev, difftype = ctx.qry.has_difftype ? ctx.qry.difftype : ctx.cfg.difftype; use_ssdiff = difftype == DIFF_SSDIFF; - if (show_ctrls) + if (show_ctrls) { + cgit_print_layout_start(); cgit_print_diff_ctrls(); + } /* * 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, if (!use_ssdiff) html("</td></tr>"); html("</table>"); + + if (show_ctrls) + cgit_print_layout_end(); } |