@@ -833,12 +833,13 @@ def handle_null_entries(self):
833
833
834
834
return entries_added
835
835
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 ]:
837
838
"""Returns a list of repo-relative paths from the given items which
838
839
may be absolute or relative paths, entries or blobs"""
839
840
paths = []
840
841
# if string put in list
841
- if isinstance (items , str ):
842
+ if isinstance (items , ( str , os . PathLike ) ):
842
843
items = [items ]
843
844
844
845
for item in items :
@@ -851,8 +852,8 @@ def _items_to_rela_paths(self, items):
851
852
# END for each item
852
853
return paths
853
854
854
- @post_clear_cache
855
- @default_index
855
+ @ post_clear_cache
856
+ @ default_index
856
857
def remove (self , items : Sequence [Union [PathLike , Blob , BaseIndexEntry , 'Submodule' ]], working_tree : bool = False ,
857
858
** kwargs : Any ) -> List [str ]:
858
859
"""Remove the given items from the index and optionally from
@@ -903,8 +904,8 @@ def remove(self, items: Sequence[Union[PathLike, Blob, BaseIndexEntry, 'Submodul
903
904
# rm 'path'
904
905
return [p [4 :- 1 ] for p in removed_paths ]
905
906
906
- @post_clear_cache
907
- @default_index
907
+ @ post_clear_cache
908
+ @ default_index
908
909
def move (self , items : Sequence [Union [PathLike , Blob , BaseIndexEntry , 'Submodule' ]], skip_errors : bool = False ,
909
910
** kwargs : Any ) -> List [Tuple [str , str ]]:
910
911
"""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
1023
1024
proc .wait ()
1024
1025
return stdout
1025
1026
1026
- @default_index
1027
+ @ default_index
1027
1028
def checkout (self , paths : Union [None , Iterable [PathLike ]] = None , force : bool = False ,
1028
1029
fprogress : Callable = lambda * args : None , ** kwargs : Any
1029
1030
) -> Union [None , Iterator [PathLike ], Sequence [PathLike ]]:
@@ -1192,7 +1193,7 @@ def handle_stderr(proc: 'Popen[bytes]', iter_checked_out_files: Iterable[PathLik
1192
1193
# END paths handling
1193
1194
assert "Should not reach this point"
1194
1195
1195
- @default_index
1196
+ @ default_index
1196
1197
def reset (self , commit : Union [Commit , 'Reference' , str ] = 'HEAD' , working_tree : bool = False ,
1197
1198
paths : Union [None , Iterable [PathLike ]] = None ,
1198
1199
head : bool = False , ** kwargs : Any ) -> 'IndexFile' :
@@ -1262,7 +1263,7 @@ def reset(self, commit: Union[Commit, 'Reference', str] = 'HEAD', working_tree:
1262
1263
1263
1264
return self
1264
1265
1265
- @default_index
1266
+ @ default_index
1266
1267
def diff (self , other : Union [diff .Diffable .Index , 'IndexFile.Index' , Treeish , None , object ] = diff .Diffable .Index ,
1267
1268
paths : Union [str , List [PathLike ], Tuple [PathLike , ...]] = None , create_patch : bool = False , ** kwargs : Any
1268
1269
) -> diff .DiffIndex :
0 commit comments