MCPcopy Create free account
hub / github.com/git/git / convert_object_file

Function convert_object_file

object-file-convert.c:253–290  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

251}
252
253int convert_object_file(struct repository *repo,
254 struct strbuf *outbuf,
255 const struct git_hash_algo *from,
256 const struct git_hash_algo *to,
257 const void *buf, size_t len,
258 enum object_type type,
259 int gentle)
260{
261 int ret;
262
263 /* Don't call this function when no conversion is necessary */
264 if ((from == to) || (type == OBJ_BLOB))
265 BUG("Refusing noop object file conversion");
266
267 switch (type) {
268 case OBJ_COMMIT:
269 ret = convert_commit_object(repo, outbuf, from, to, buf, len);
270 break;
271 case OBJ_TREE:
272 ret = convert_tree_object(repo, outbuf, from, to, buf, len);
273 break;
274 case OBJ_TAG:
275 ret = convert_tag_object(repo, outbuf, from, to, buf, len);
276 break;
277 default:
278 /* Not implemented yet, so fail. */
279 ret = -1;
280 break;
281 }
282 if (!ret)
283 return 0;
284 if (gentle) {
285 strbuf_release(outbuf);
286 return ret;
287 }
288 die(_("Failed to convert object from %s to %s"),
289 from->name, to->name);
290}

Callers 4

oid_object_info_convertFunction · 0.85
do_signFunction · 0.85

Calls 5

convert_commit_objectFunction · 0.85
convert_tree_objectFunction · 0.85
convert_tag_objectFunction · 0.85
strbuf_releaseFunction · 0.85
dieFunction · 0.70

Tested by

no test coverage detected