| 220 | "so the whole object may be read and then the header will be returned."); |
| 221 | |
| 222 | PyObject * |
| 223 | Odb_read_header(Odb *self, PyObject *py_hex) |
| 224 | { |
| 225 | git_oid oid; |
| 226 | int err; |
| 227 | size_t len; |
| 228 | git_object_t type; |
| 229 | PyObject* type_enum; |
| 230 | PyObject* tuple; |
| 231 | |
| 232 | len = py_oid_to_git_oid(py_hex, &oid); |
| 233 | if (len == 0) |
| 234 | return NULL; |
| 235 | |
| 236 | err = git_odb_read_header(&len, &type, self->odb, &oid); |
| 237 | if (err != 0) { |
| 238 | Error_set_oid(err, &oid, len); |
| 239 | return NULL; |
| 240 | } |
| 241 | |
| 242 | // Convert type to ObjectType enum |
| 243 | type_enum = pygit2_enum(ObjectTypeEnum, type); |
| 244 | |
| 245 | tuple = Py_BuildValue("(On)", type_enum, len); |
| 246 | return tuple; |
| 247 | } |
| 248 | |
| 249 | PyDoc_STRVAR(Odb_write__doc__, |
| 250 | "write(type: int, data: bytes) -> Oid\n" |
nothing calls this directly
no test coverage detected
searching dependent graphs…