| 1454 | } |
| 1455 | |
| 1456 | int git_config_from_blob_oid(config_fn_t fn, |
| 1457 | const char *name, |
| 1458 | struct repository *repo, |
| 1459 | const struct object_id *oid, |
| 1460 | void *data, |
| 1461 | enum config_scope scope) |
| 1462 | { |
| 1463 | enum object_type type; |
| 1464 | char *buf; |
| 1465 | size_t size; |
| 1466 | int ret; |
| 1467 | |
| 1468 | buf = odb_read_object(repo->objects, oid, &type, &size); |
| 1469 | if (!buf) |
| 1470 | return error(_("unable to load config blob object '%s'"), name); |
| 1471 | if (type != OBJ_BLOB) { |
| 1472 | free(buf); |
| 1473 | return error(_("reference '%s' does not point to a blob"), name); |
| 1474 | } |
| 1475 | |
| 1476 | ret = git_config_from_mem(fn, CONFIG_ORIGIN_BLOB, name, buf, size, |
| 1477 | data, scope, NULL); |
| 1478 | free(buf); |
| 1479 | |
| 1480 | return ret; |
| 1481 | } |
| 1482 | |
| 1483 | static int git_config_from_blob_ref(config_fn_t fn, |
| 1484 | struct repository *repo, |
no test coverage detected