@@ -833,12 +833,13 @@ def handle_null_entries(self):
833833
834834 return entries_added
835835
836- def _items_to_rela_paths (self , items ):
836+ def _items_to_rela_paths (self , items : Union [PathLike , Sequence [Union [PathLike , BaseIndexEntry , Blob , Submodule ]]]
837+ ) -> List [PathLike ]:
837838 """Returns a list of repo-relative paths from the given items which
838839 may be absolute or relative paths, entries or blobs"""
839840 paths = []
840841 # if string put in list
841- if isinstance (items , str ):
842+ if isinstance (items , ( str , os . PathLike ) ):
842843 items = [items ]
843844
844845 for item in items :
@@ -851,8 +852,8 @@ def _items_to_rela_paths(self, items):
851852 # END for each item
852853 return paths
853854
854- @post_clear_cache
855- @default_index
855+ @ post_clear_cache
856+ @ default_index
856857 def remove (self , items : Sequence [Union [PathLike , Blob , BaseIndexEntry , 'Submodule' ]], working_tree : bool = False ,
857858 ** kwargs : Any ) -> List [str ]:
858859 """Remove the given items from the index and optionally from
@@ -903,8 +904,8 @@ def remove(self, items: Sequence[Union[PathLike, Blob, BaseIndexEntry, 'Submodul
903904 # rm 'path'
904905 return [p [4 :- 1 ] for p in removed_paths ]
905906
906- @post_clear_cache
907- @default_index
907+ @ post_clear_cache
908+ @ default_index
908909 def move (self , items : Sequence [Union [PathLike , Blob , BaseIndexEntry , 'Submodule' ]], skip_errors : bool = False ,
909910 ** kwargs : Any ) -> List [Tuple [str , str ]]:
910911 """Rename/move the items, whereas the last item is considered the destination of
@@ -1023,7 +1024,7 @@ def _flush_stdin_and_wait(cls, proc: 'Popen[bytes]', ignore_stdout: bool = False
10231024 proc .wait ()
10241025 return stdout
10251026
1026- @default_index
1027+ @ default_index
10271028 def checkout (self , paths : Union [None , Iterable [PathLike ]] = None , force : bool = False ,
10281029 fprogress : Callable = lambda * args : None , ** kwargs : Any
10291030 ) -> Union [None , Iterator [PathLike ], Sequence [PathLike ]]:
@@ -1192,7 +1193,7 @@ def handle_stderr(proc: 'Popen[bytes]', iter_checked_out_files: Iterable[PathLik
11921193 # END paths handling
11931194 assert "Should not reach this point"
11941195
1195- @default_index
1196+ @ default_index
11961197 def reset (self , commit : Union [Commit , 'Reference' , str ] = 'HEAD' , working_tree : bool = False ,
11971198 paths : Union [None , Iterable [PathLike ]] = None ,
11981199 head : bool = False , ** kwargs : Any ) -> 'IndexFile' :
@@ -1262,7 +1263,7 @@ def reset(self, commit: Union[Commit, 'Reference', str] = 'HEAD', working_tree:
12621263
12631264 return self
12641265
1265- @default_index
1266+ @ default_index
12661267 def diff (self , other : Union [diff .Diffable .Index , 'IndexFile.Index' , Treeish , None , object ] = diff .Diffable .Index ,
12671268 paths : Union [str , List [PathLike ], Tuple [PathLike , ...]] = None , create_patch : bool = False , ** kwargs : Any
12681269 ) -> diff .DiffIndex :
0 commit comments