diff options
author | Yobmod <yobmod@gmail.com> | 2021-07-09 16:27:34 +0100 |
---|---|---|
committer | Yobmod <yobmod@gmail.com> | 2021-07-09 16:27:34 +0100 |
commit | 797e962fc1811ddc5a5a34308bd243953eb77135 (patch) | |
tree | 8c4d3334c4ae2f4a579ed962c0d1e3b0d7e47b0f | |
parent | b03af0547f5381cf4043a43acf533687d91f0ea1 (diff) | |
download | gitpython-797e962fc1811ddc5a5a34308bd243953eb77135.tar.gz |
Make IndexFile and Diffable .diff() types agree
-rw-r--r-- | git/diff.py | 3 | ||||
-rw-r--r-- | git/index/base.py | 3 |
2 files changed, 4 insertions, 2 deletions
diff --git a/git/diff.py b/git/diff.py index 1e2ee740..7ca98ec3 100644 --- a/git/diff.py +++ b/git/diff.py @@ -20,6 +20,7 @@ from git.types import PathLike, TBD, Literal, TypeGuard if TYPE_CHECKING: from .objects.tree import Tree + from .objects import Commit from git.repo.base import Repo from git.objects.base import IndexObject from subprocess import Popen @@ -90,7 +91,7 @@ class Diffable(object): Subclasses can use it to alter the behaviour of the superclass""" return args - def diff(self, other: Union[Type['Index'], 'Tree', None, str] = Index, + def diff(self, other: Union[Type['Index'], 'Tree', 'Commit', None, str] = Index, # object for git.NULL_TREE paths: Union[PathLike, List[PathLike], Tuple[PathLike, ...], None] = None, create_patch: bool = False, **kwargs: Any) -> 'DiffIndex': """Creates diffs between two items being trees, trees and index or an diff --git a/git/index/base.py b/git/index/base.py index 149edf5a..75df5184 100644 --- a/git/index/base.py +++ b/git/index/base.py @@ -1273,7 +1273,8 @@ class IndexFile(LazyMixin, git_diff.Diffable, Serializable): # @ default_index, breaks typing for some reason, copied into function def diff(self, - other: Union[git_diff.Diffable.Index, 'IndexFile.Index', Treeish, None, object] = git_diff.Diffable.Index, + other: Union[Type['git_diff.Diffable.Index'], 'IndexFile.Index', + 'Tree', 'Commit', str, None] = git_diff.Diffable.Index, paths: Union[PathLike, List[PathLike], Tuple[PathLike, ...], None] = None, create_patch: bool = False, **kwargs: Any ) -> git_diff.DiffIndex: |