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)
| 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): |
nothing calls this directly
no test coverage detected