diff options
Diffstat (limited to 'ui-blame.c')
| -rw-r--r-- | ui-blame.c | 20 |
1 files changed, 10 insertions, 10 deletions
| @@ -49,7 +49,7 @@ static void emit_blame_entry_hash(struct blame_entry *ent) | |||
| 49 | 49 | ||
| 50 | char *detail = emit_suspect_detail(suspect); | 50 | char *detail = emit_suspect_detail(suspect); |
| 51 | html("<span class='sha1'>"); | 51 | html("<span class='sha1'>"); |
| 52 | cgit_commit_link(find_unique_abbrev(oid->hash, DEFAULT_ABBREV), detail, | 52 | cgit_commit_link(find_unique_abbrev(oid, DEFAULT_ABBREV), detail, |
| 53 | NULL, ctx.qry.head, oid_to_hex(oid), suspect->path); | 53 | NULL, ctx.qry.head, oid_to_hex(oid), suspect->path); |
| 54 | html("</span>"); | 54 | html("</span>"); |
| 55 | free(detail); | 55 | free(detail); |
| @@ -98,7 +98,7 @@ struct walk_tree_context { | |||
| 98 | int state; | 98 | int state; |
| 99 | }; | 99 | }; |
| 100 | 100 | ||
| 101 | static void print_object(const unsigned char *sha1, const char *path, | 101 | static void print_object(const struct object_id *oid, const char *path, |
| 102 | const char *basename, const char *rev) | 102 | const char *basename, const char *rev) |
| 103 | { | 103 | { |
| 104 | enum object_type type; | 104 | enum object_type type; |
| @@ -110,17 +110,17 @@ static void print_object(const unsigned char *sha1, const char *path, | |||
| 110 | struct blame_origin *o; | 110 | struct blame_origin *o; |
| 111 | struct blame_entry *ent = NULL; | 111 | struct blame_entry *ent = NULL; |
| 112 | 112 | ||
| 113 | type = sha1_object_info(sha1, &size); | 113 | type = oid_object_info(the_repository, oid, &size); |
| 114 | if (type == OBJ_BAD) { | 114 | if (type == OBJ_BAD) { |
| 115 | cgit_print_error_page(404, "Not found", "Bad object name: %s", | 115 | cgit_print_error_page(404, "Not found", "Bad object name: %s", |
| 116 | sha1_to_hex(sha1)); | 116 | oid_to_hex(oid)); |
| 117 | return; | 117 | return; |
| 118 | } | 118 | } |
| 119 | 119 | ||
| 120 | buf = read_sha1_file(sha1, &type, &size); | 120 | buf = read_object_file(oid, &type, &size); |
| 121 | if (!buf) { | 121 | if (!buf) { |
| 122 | cgit_print_error_page(500, "Internal server error", | 122 | cgit_print_error_page(500, "Internal server error", |
| 123 | "Error reading object %s", sha1_to_hex(sha1)); | 123 | "Error reading object %s", oid_to_hex(oid)); |
| 124 | return; | 124 | return; |
| 125 | } | 125 | } |
| 126 | 126 | ||
| @@ -144,7 +144,7 @@ static void print_object(const unsigned char *sha1, const char *path, | |||
| 144 | cgit_set_title_from_path(path); | 144 | cgit_set_title_from_path(path); |
| 145 | 145 | ||
| 146 | cgit_print_layout_start(); | 146 | cgit_print_layout_start(); |
| 147 | htmlf("blob: %s (", sha1_to_hex(sha1)); | 147 | htmlf("blob: %s (", oid_to_hex(oid)); |
| 148 | cgit_plain_link("plain", NULL, NULL, ctx.qry.head, rev, path); | 148 | cgit_plain_link("plain", NULL, NULL, ctx.qry.head, rev, path); |
| 149 | html(") ("); | 149 | html(") ("); |
| 150 | cgit_tree_link("tree", NULL, NULL, ctx.qry.head, rev, path); | 150 | cgit_tree_link("tree", NULL, NULL, ctx.qry.head, rev, path); |
| @@ -218,7 +218,7 @@ cleanup: | |||
| 218 | free(buf); | 218 | free(buf); |
| 219 | } | 219 | } |
| 220 | 220 | ||
| 221 | static int walk_tree(const unsigned char *sha1, struct strbuf *base, | 221 | static int walk_tree(const struct object_id *oid, struct strbuf *base, |
| 222 | const char *pathname, unsigned mode, int stage, | 222 | const char *pathname, unsigned mode, int stage, |
| 223 | void *cbdata) | 223 | void *cbdata) |
| 224 | { | 224 | { |
| @@ -229,7 +229,7 @@ static int walk_tree(const unsigned char *sha1, struct strbuf *base, | |||
| 229 | struct strbuf buffer = STRBUF_INIT; | 229 | struct strbuf buffer = STRBUF_INIT; |
| 230 | strbuf_addbuf(&buffer, base); | 230 | strbuf_addbuf(&buffer, base); |
| 231 | strbuf_addstr(&buffer, pathname); | 231 | strbuf_addstr(&buffer, pathname); |
| 232 | print_object(sha1, buffer.buf, pathname, | 232 | print_object(oid, buffer.buf, pathname, |
| 233 | walk_tree_ctx->curr_rev); | 233 | walk_tree_ctx->curr_rev); |
| 234 | strbuf_release(&buffer); | 234 | strbuf_release(&buffer); |
| 235 | walk_tree_ctx->state = 1; | 235 | walk_tree_ctx->state = 1; |
| @@ -289,7 +289,7 @@ void cgit_print_blame(void) | |||
| 289 | walk_tree_ctx.match_baselen = (path_items.match) ? | 289 | walk_tree_ctx.match_baselen = (path_items.match) ? |
| 290 | basedir_len(path_items.match) : -1; | 290 | basedir_len(path_items.match) : -1; |
| 291 | 291 | ||
| 292 | read_tree_recursive(commit->tree, "", 0, 0, &paths, walk_tree, | 292 | read_tree_recursive(commit->maybe_tree, "", 0, 0, &paths, walk_tree, |
| 293 | &walk_tree_ctx); | 293 | &walk_tree_ctx); |
| 294 | if (!walk_tree_ctx.state) | 294 | if (!walk_tree_ctx.state) |
| 295 | cgit_print_error_page(404, "Not found", "Not found"); | 295 | cgit_print_error_page(404, "Not found", "Not found"); |
