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

Method __init__

pygit2/index.py:48–60  ·  view source on GitHub ↗

Create a new Index If path is supplied, the read and write methods will use that path to read from and write to.

(self, path: str | PathLike[str] | None = None)

Source from the content-addressed store, hash-verified

46 # from C code (see Tree_diff_to_index)
47
48 def __init__(self, path: str | PathLike[str] | None = None) -> None:
49 """Create a new Index
50
51 If path is supplied, the read and write methods will use that path
52 to read from and write to.
53 """
54 cindex = ffi.new('git_index **')
55 err = C.git_index_open(cindex, to_bytes(path))
56 check_error(err)
57
58 self._repo = None
59 self._index = cindex[0]
60 self._cindex = cindex
61
62 @classmethod
63 def from_c(cls, repo, ptr):

Callers

nothing calls this directly

Calls 2

to_bytesFunction · 0.85
check_errorFunction · 0.85

Tested by

no test coverage detected