about summary refs log tree commit diff stats
path: root/ui-patch.c
diff options
context:
space:
mode:
authorJohn Keeping2015-08-14 12:47:07 +0100
committerJason A. Donenfeld2015-08-14 15:46:51 +0200
commite3e41e5125b1ce270b5afb42beb83e14c0f350cb (patch)
treee6019b21f91e4ae9f847830740cf89fabf360171 /ui-patch.c
parentblob: use cgit_print_error_page() to add HTTP headers (diff)
downloadcgit-e3e41e5125b1ce270b5afb42beb83e14c0f350cb.tar.gz
cgit-e3e41e5125b1ce270b5afb42beb83e14c0f350cb.zip
patch: use cgit_print_error_page() for HTTP status codes
Signed-off-by: John Keeping <john@keeping.me.uk>
Diffstat (limited to 'ui-patch.c')
-rw-r--r--ui-patch.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/ui-patch.c b/ui-patch.c index 57ca2f8..430231e 100644 --- a/ui-patch.c +++ b/ui-patch.c
@@ -25,26 +25,26 @@ void cgit_print_patch(const char *new_rev, const char *old_rev,
25 new_rev = ctx.qry.head; 25 new_rev = ctx.qry.head;
26 26
27 if (get_sha1(new_rev, new_rev_sha1)) { 27 if (get_sha1(new_rev, new_rev_sha1)) {
28 cgit_print_http_headers(); 28 cgit_print_error_page(404, "Not found",
29 cgit_print_error("Bad object id: %s", new_rev); 29 "Bad object id: %s", new_rev);
30 return; 30 return;
31 } 31 }
32 commit = lookup_commit_reference(new_rev_sha1); 32 commit = lookup_commit_reference(new_rev_sha1);
33 if (!commit) { 33 if (!commit) {
34 cgit_print_http_headers(); 34 cgit_print_error_page(404, "Not found",
35 cgit_print_error("Bad commit reference: %s", new_rev); 35 "Bad commit reference: %s", new_rev);
36 return; 36 return;
37 } 37 }
38 38
39 if (old_rev) { 39 if (old_rev) {
40 if (get_sha1(old_rev, old_rev_sha1)) { 40 if (get_sha1(old_rev, old_rev_sha1)) {
41 cgit_print_http_headers(); 41 cgit_print_error_page(404, "Not found",
42 cgit_print_error("Bad object id: %s", old_rev); 42 "Bad object id: %s", old_rev);
43 return; 43 return;
44 } 44 }
45 if (!lookup_commit_reference(old_rev_sha1)) { 45 if (!lookup_commit_reference(old_rev_sha1)) {
46 cgit_print_http_headers(); 46 cgit_print_error_page(404, "Not found",
47 cgit_print_error("Bad commit reference: %s", old_rev); 47 "Bad commit reference: %s", old_rev);
48 return; 48 return;
49 } 49 }
50 } else if (commit->parents && commit->parents->item) { 50 } else if (commit->parents && commit->parents->item) {