| 389 | } |
| 390 | |
| 391 | const void *repo_get_commit_buffer(struct repository *r, |
| 392 | const struct commit *commit, |
| 393 | unsigned long *sizep) |
| 394 | { |
| 395 | const void *ret = get_cached_commit_buffer(r, commit, sizep); |
| 396 | if (!ret) { |
| 397 | enum object_type type; |
| 398 | size_t size; |
| 399 | ret = odb_read_object(r->objects, &commit->object.oid, &type, &size); |
| 400 | if (!ret) |
| 401 | die("cannot read commit object %s", |
| 402 | oid_to_hex(&commit->object.oid)); |
| 403 | if (type != OBJ_COMMIT) |
| 404 | die("expected commit for %s, got %s", |
| 405 | oid_to_hex(&commit->object.oid), type_name(type)); |
| 406 | if (sizep) |
| 407 | *sizep = cast_size_t_to_ulong(size); |
| 408 | } |
| 409 | return ret; |
| 410 | } |
| 411 | |
| 412 | void repo_unuse_commit_buffer(struct repository *r, |
| 413 | const struct commit *commit, |
no test coverage detected