MCPcopy Index your code
hub / github.com/git/git / convert_tree_object

Function convert_tree_object

object-file-convert.c:72–96  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

70}
71
72static 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
98static int convert_tag_object(struct repository *repo,
99 struct strbuf *out,

Callers 1

convert_object_fileFunction · 0.85

Calls 5

decode_tree_entry_rawFunction · 0.85
errorFunction · 0.85
repo_oid_to_algopFunction · 0.85
oid_to_hexFunction · 0.85
strbuf_addFunction · 0.85

Tested by

no test coverage detected