summaryrefslogtreecommitdiff
path: root/git
diff options
context:
space:
mode:
authorYobmod <yobmod@gmail.com>2021-05-15 22:58:47 +0100
committerYobmod <yobmod@gmail.com>2021-05-15 22:58:47 +0100
commit4dff2004308a7a1e5b9afc7a5b3b9cb515e12514 (patch)
treee6b61681ae98d18430d9955cd2e697e87e13dada /git
parent96364599258e7e036298dd5737918bde346ec195 (diff)
downloadgitpython-4dff2004308a7a1e5b9afc7a5b3b9cb515e12514.tar.gz
Add initial types to IndexFile .init() to _to_relative_path()
Diffstat (limited to 'git')
-rw-r--r--git/index/base.py4
-rw-r--r--git/index/fun.py8
2 files changed, 6 insertions, 6 deletions
diff --git a/git/index/base.py b/git/index/base.py
index 4dcfb30d..6a4bacc4 100644
--- a/git/index/base.py
+++ b/git/index/base.py
@@ -490,8 +490,8 @@ class IndexFile(LazyMixin, diff.Diffable, Serializable):
return path_map
@classmethod
- def entry_key(cls, entry: Union[Tuple[BaseIndexEntry], Tuple[PathLike, StageType]]) -> Tuple[PathLike, StageType]:
- return entry_key(entry)
+ def entry_key(cls, *entry: Union[Tuple[BaseIndexEntry], Tuple[PathLike, StageType]]) -> Tuple[PathLike, StageType]:
+ return entry_key(*entry)
def resolve_blobs(self, iter_blobs: Iterator[Blob]) -> 'IndexFile':
"""Resolve the blobs given in blob iterator. This will effectively remove the
diff --git a/git/index/fun.py b/git/index/fun.py
index ea7a404b..85b85ed5 100644
--- a/git/index/fun.py
+++ b/git/index/fun.py
@@ -1,7 +1,7 @@
# Contains standalone functions to accompany the index implementation and make it
# more versatile
# NOTE: Autodoc hates it if this is a docstring
-from git.types import PathLike, TBD
+from git.types import PathLike
from io import BytesIO
import os
from stat import (
@@ -168,13 +168,13 @@ def read_header(stream):
return version, num_entries
-def entry_key(entry: Union[Tuple[BaseIndexEntry], Tuple[PathLike, TBD]]):
+def entry_key(*entry: Union[Tuple[BaseIndexEntry], Tuple[PathLike, int]]):
""":return: Key suitable to be used for the index.entries dictionary
:param entry: One instance of type BaseIndexEntry or the path and the stage"""
- if len(entry) == 1:
+ if len(*entry) == 1:
entry_first = cast(BaseIndexEntry, entry[0]) # type: BaseIndexEntry
return (entry_first.path, entry_first.stage)
- return tuple(entry)
+ return tuple(*entry)
# END handle entry