| 70 | } |
| 71 | |
| 72 | static int convert_tree_object(struct repository *repo, |
| 73 | struct strbuf *out, |
| 74 | const struct git_hash_algo *from, |
| 75 | const struct git_hash_algo *to, |
| 76 | const char *buffer, size_t size) |
| 77 | { |
| 78 | const char *p = buffer, *end = buffer + size; |
| 79 | |
| 80 | while (p < end) { |
| 81 | struct object_id entry_oid, mapped_oid; |
| 82 | const char *path = NULL; |
| 83 | size_t pathlen; |
| 84 | |
| 85 | if (decode_tree_entry_raw(&entry_oid, &path, &pathlen, from, p, |
| 86 | end - p)) |
| 87 | return error(_("failed to decode tree entry")); |
| 88 | if (repo_oid_to_algop(repo, &entry_oid, to, &mapped_oid)) |
| 89 | return error(_("failed to map tree entry for %s"), oid_to_hex(&entry_oid)); |
| 90 | strbuf_add(out, p, path - p); |
| 91 | strbuf_add(out, path, pathlen); |
| 92 | strbuf_add(out, mapped_oid.hash, to->rawsz); |
| 93 | p = path + pathlen + from->rawsz; |
| 94 | } |
| 95 | return 0; |
| 96 | } |
| 97 | |
| 98 | static int convert_tag_object(struct repository *repo, |
| 99 | struct strbuf *out, |
no test coverage detected