Skip to content

Commit c3f91bd

Browse files
committed
Add initial types to IndexFile .init() to _to_relative_path()
1 parent 4dff200 commit c3f91bd

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

git/index/fun.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
S_IFREG,
1414
)
1515
import subprocess
16-
from typing import List, Tuple, Union, cast
16+
from typing import List, Tuple, cast
1717

1818
from git.cmd import PROC_CREATIONFLAGS, handle_process_output
1919
from git.compat import (
@@ -168,13 +168,15 @@ def read_header(stream):
168168
return version, num_entries
169169

170170

171-
def entry_key(*entry: Union[Tuple[BaseIndexEntry], Tuple[PathLike, int]]):
171+
def entry_key(*entry) -> Tuple[PathLike, int]:
172172
""":return: Key suitable to be used for the index.entries dictionary
173173
:param entry: One instance of type BaseIndexEntry or the path and the stage"""
174-
if len(*entry) == 1:
174+
if len(entry) == 1:
175175
entry_first = cast(BaseIndexEntry, entry[0]) # type: BaseIndexEntry
176176
return (entry_first.path, entry_first.stage)
177-
return tuple(*entry)
177+
else:
178+
entry = cast(Tuple[PathLike, int], tuple(entry))
179+
return entry
178180
# END handle entry
179181

180182

0 commit comments

Comments
 (0)