Convert this entry into the C structure The first returned arg is the pointer, the second is the reference to the string we allocated, which we need to exist past this function
(self)
| 466 | ) |
| 467 | |
| 468 | def _to_c(self) -> tuple['ffi.GitIndexEntryC', 'ffi.ArrayC[ffi.char]']: |
| 469 | """Convert this entry into the C structure |
| 470 | |
| 471 | The first returned arg is the pointer, the second is the reference to |
| 472 | the string we allocated, which we need to exist past this function |
| 473 | """ |
| 474 | centry = ffi.new('git_index_entry *') |
| 475 | # basically memcpy() |
| 476 | ffi.buffer(ffi.addressof(centry, 'id'))[:] = self.id.raw[:] |
| 477 | centry.mode = int(self.mode) |
| 478 | path = ffi.new('char[]', to_bytes(self.path)) |
| 479 | centry.path = path |
| 480 | |
| 481 | return centry, path |
| 482 | |
| 483 | @classmethod |
| 484 | def _from_c(cls, centry): |
no test coverage detected