From 59a0c88a08de4b35608d82b107844915a787f192 Mon Sep 17 00:00:00 2001 From: Andrej730 Date: Mon, 3 Jun 2024 00:26:11 +0500 Subject: [PATCH] Fix IndexFile items argument type Error before commit: path: os.PathLike = ... repo = git.Repo(path_dir) repo.index.add(path) --- git/index/base.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/git/index/base.py b/git/index/base.py index b8161ea52..fc4474cac 100644 --- a/git/index/base.py +++ b/git/index/base.py @@ -658,7 +658,7 @@ def _to_relative_path(self, path: PathLike) -> PathLike: return os.path.relpath(path, self.repo.working_tree_dir) def _preprocess_add_items( - self, items: Sequence[Union[PathLike, Blob, BaseIndexEntry, "Submodule"]] + self, items: Union[PathLike, Sequence[Union[PathLike, Blob, BaseIndexEntry, "Submodule"]]] ) -> Tuple[List[PathLike], List[BaseIndexEntry]]: """Split the items into two lists of path strings and BaseEntries.""" paths = [] @@ -749,7 +749,7 @@ def _entries_for_paths( def add( self, - items: Sequence[Union[PathLike, Blob, BaseIndexEntry, "Submodule"]], + items: Union[PathLike, Sequence[Union[PathLike, Blob, BaseIndexEntry, "Submodule"]]], force: bool = True, fprogress: Callable = lambda *args: None, path_rewriter: Union[Callable[..., PathLike], None] = None, @@ -976,7 +976,7 @@ def _items_to_rela_paths( @default_index def remove( self, - items: Sequence[Union[PathLike, Blob, BaseIndexEntry, "Submodule"]], + items: Union[PathLike, Sequence[Union[PathLike, Blob, BaseIndexEntry, "Submodule"]]], working_tree: bool = False, **kwargs: Any, ) -> List[str]: @@ -1036,7 +1036,7 @@ def remove( @default_index def move( self, - items: Sequence[Union[PathLike, Blob, BaseIndexEntry, "Submodule"]], + items: Union[PathLike, Sequence[Union[PathLike, Blob, BaseIndexEntry, "Submodule"]]], skip_errors: bool = False, **kwargs: Any, ) -> List[Tuple[str, str]]: