MCPcopy Create free account
hub / github.com/libgit2/pygit2 / _to_c

Method _to_c

pygit2/index.py:468–481  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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):

Callers 3

merge_file_from_indexMethod · 0.80
addMethod · 0.80
add_conflictMethod · 0.80

Calls 1

to_bytesFunction · 0.85

Tested by

no test coverage detected