| 177 | "Read raw object data from the object db."); |
| 178 | |
| 179 | PyObject * |
| 180 | Odb_read(Odb *self, PyObject *py_hex) |
| 181 | { |
| 182 | git_oid oid; |
| 183 | git_odb_object *obj; |
| 184 | size_t len; |
| 185 | git_object_t type; |
| 186 | PyObject* type_enum; |
| 187 | PyObject* tuple; |
| 188 | |
| 189 | len = py_oid_to_git_oid(py_hex, &oid); |
| 190 | if (len == 0) |
| 191 | return NULL; |
| 192 | |
| 193 | obj = Odb_read_raw(self->odb, &oid, len); |
| 194 | if (obj == NULL) |
| 195 | return NULL; |
| 196 | |
| 197 | // Convert type to ObjectType enum |
| 198 | type = git_odb_object_type(obj); |
| 199 | type_enum = pygit2_enum(ObjectTypeEnum, type); |
| 200 | |
| 201 | tuple = Py_BuildValue( |
| 202 | "(Oy#)", |
| 203 | type_enum, |
| 204 | git_odb_object_data(obj), |
| 205 | git_odb_object_size(obj)); |
| 206 | |
| 207 | git_odb_object_free(obj); |
| 208 | return tuple; |
| 209 | } |
| 210 | |
| 211 | PyDoc_STRVAR(Odb_read_header__doc__, |
| 212 | "read_header(oid: Oid) -> tuple[enums.ObjectType, int]\n" |
nothing calls this directly
no test coverage detected
searching dependent graphs…