diff options
| -rw-r--r-- | cmd.c | 2 | ||||
| -rw-r--r-- | ui-tag.c | 13 |
2 files changed, 11 insertions, 4 deletions
| @@ -171,7 +171,7 @@ struct cgit_cmd *cgit_get_cmd(void) | |||
| 171 | def_cmd(snapshot, 1, 0, 0, 0), | 171 | def_cmd(snapshot, 1, 0, 0, 0), |
| 172 | def_cmd(stats, 1, 0, 1, 0), | 172 | def_cmd(stats, 1, 0, 1, 0), |
| 173 | def_cmd(summary, 1, 0, 0, 0), | 173 | def_cmd(summary, 1, 0, 0, 0), |
| 174 | def_cmd(tag, 1, 1, 0, 0), | 174 | def_cmd(tag, 1, 0, 0, 0), |
| 175 | def_cmd(tree, 1, 1, 1, 0), | 175 | def_cmd(tree, 1, 1, 1, 0), |
| 176 | }; | 176 | }; |
| 177 | int i; | 177 | int i; |
| @@ -52,20 +52,24 @@ void cgit_print_tag(char *revname) | |||
| 52 | 52 | ||
| 53 | strbuf_addf(&fullref, "refs/tags/%s", revname); | 53 | strbuf_addf(&fullref, "refs/tags/%s", revname); |
| 54 | if (get_sha1(fullref.buf, sha1)) { | 54 | if (get_sha1(fullref.buf, sha1)) { |
| 55 | cgit_print_error("Bad tag reference: %s", revname); | 55 | cgit_print_error_page(404, "Not found", |
| 56 | "Bad tag reference: %s", revname); | ||
| 56 | goto cleanup; | 57 | goto cleanup; |
| 57 | } | 58 | } |
| 58 | obj = parse_object(sha1); | 59 | obj = parse_object(sha1); |
| 59 | if (!obj) { | 60 | if (!obj) { |
| 60 | cgit_print_error("Bad object id: %s", sha1_to_hex(sha1)); | 61 | cgit_print_error_page(500, "Internal server error", |
| 62 | "Bad object id: %s", sha1_to_hex(sha1)); | ||
| 61 | goto cleanup; | 63 | goto cleanup; |
| 62 | } | 64 | } |
| 63 | if (obj->type == OBJ_TAG) { | 65 | if (obj->type == OBJ_TAG) { |
| 64 | tag = lookup_tag(sha1); | 66 | tag = lookup_tag(sha1); |
| 65 | if (!tag || parse_tag(tag) || !(info = cgit_parse_tag(tag))) { | 67 | if (!tag || parse_tag(tag) || !(info = cgit_parse_tag(tag))) { |
| 66 | cgit_print_error("Bad tag object: %s", revname); | 68 | cgit_print_error_page(500, "Internal server error", |
| 69 | "Bad tag object: %s", revname); | ||
| 67 | goto cleanup; | 70 | goto cleanup; |
| 68 | } | 71 | } |
| 72 | cgit_print_layout_start(); | ||
| 69 | html("<table class='commit-info'>\n"); | 73 | html("<table class='commit-info'>\n"); |
| 70 | htmlf("<tr><td>tag name</td><td>"); | 74 | htmlf("<tr><td>tag name</td><td>"); |
| 71 | html_txt(revname); | 75 | html_txt(revname); |
| @@ -93,7 +97,9 @@ void cgit_print_tag(char *revname) | |||
| 93 | print_download_links(revname); | 97 | print_download_links(revname); |
| 94 | html("</table>\n"); | 98 | html("</table>\n"); |
| 95 | print_tag_content(info->msg); | 99 | print_tag_content(info->msg); |
| 100 | cgit_print_layout_end(); | ||
| 96 | } else { | 101 | } else { |
| 102 | cgit_print_layout_start(); | ||
| 97 | html("<table class='commit-info'>\n"); | 103 | html("<table class='commit-info'>\n"); |
| 98 | htmlf("<tr><td>tag name</td><td>"); | 104 | htmlf("<tr><td>tag name</td><td>"); |
| 99 | html_txt(revname); | 105 | html_txt(revname); |
| @@ -104,6 +110,7 @@ void cgit_print_tag(char *revname) | |||
| 104 | if (ctx.repo->snapshots) | 110 | if (ctx.repo->snapshots) |
| 105 | print_download_links(revname); | 111 | print_download_links(revname); |
| 106 | html("</table>\n"); | 112 | html("</table>\n"); |
| 113 | cgit_print_layout_end(); | ||
| 107 | } | 114 | } |
| 108 | 115 | ||
| 109 | cleanup: | 116 | cleanup: |
