diff options
| author | Christian Hesse | 2018-06-04 18:49:28 +0200 |
|---|---|---|
| committer | Jason A. Donenfeld | 2018-06-27 18:13:03 +0200 |
| commit | 255b78ff5291cef79978b025c9872f801de89e23 (patch) | |
| tree | 7938fdb3af17e39507d282595e1591b0984cc2ec /ui-blame.c | |
| parent | 54d37dc154f5308459df0a90c81dabd0245b6c17 (diff) | |
| download | cgit-255b78ff5291cef79978b025c9872f801de89e23.tar.gz cgit-255b78ff5291cef79978b025c9872f801de89e23.tar.bz2 cgit-255b78ff5291cef79978b025c9872f801de89e23.zip | |
git: update to v2.18.0
Update to git version v2.18.0. Required changes follow upstream commits:
* Convert find_unique_abbrev* to struct object_id
(aab9583f7b5ea5463eb3f653a0b4ecac7539dc94)
* sha1_file: convert read_sha1_file to struct object_id
(b4f5aca40e6f77cbabcbf4ff003c3cf30a1830c8)
* sha1_file: convert sha1_object_info* to object_id
(abef9020e3df87c441c9a3a95f592fce5fa49bb9)
* object-store: move packed_git and packed_git_mru to object store
(a80d72db2a73174b3f22142eb2014b33696fd795)
* treewide: rename tree to maybe_tree
(891435d55da80ca3654b19834481205be6bdfe33)
The changed data types required some of our own functions to be converted
to struct object_id:
ls_item
print_dir
print_dir_entry
print_object
single_tree_cb
walk_tree
write_tree_link
And finally we use new upstream functions that were added for
struct object_id:
hashcpy -> oidcpy
sha1_to_hex -> oid_to_hex
Signed-off-by: Christian Hesse <mail@eworm.de>
Reviewed-by: John Keeping <john@keeping.me.uk>
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"); |
