Look up submodule information by name or path. Raises KeyError if there is no such submodule.
(self, name: str | Path)
| 188 | self._repository = repository |
| 189 | |
| 190 | def __getitem__(self, name: str | Path) -> Submodule: |
| 191 | """ |
| 192 | Look up submodule information by name or path. |
| 193 | Raises KeyError if there is no such submodule. |
| 194 | """ |
| 195 | csub = ffi.new('git_submodule **') |
| 196 | cpath = ffi.new('char[]', to_bytes(name)) |
| 197 | |
| 198 | err = C.git_submodule_lookup(csub, self._repository._repo, cpath) |
| 199 | check_error(err) |
| 200 | return Submodule._from_c(self._repository, csub[0]) |
| 201 | |
| 202 | def __contains__(self, name: str) -> bool: |
| 203 | return self.get(name) is not None |
nothing calls this directly
no test coverage detected