diff options
-rw-r--r-- | git/diff.py | 8 | ||||
-rw-r--r-- | git/index/base.py | 10 |
2 files changed, 9 insertions, 9 deletions
diff --git a/git/diff.py b/git/diff.py index 7ca98ec3..51dac390 100644 --- a/git/diff.py +++ b/git/diff.py @@ -82,8 +82,8 @@ class Diffable(object): class Index(object): pass - def _process_diff_args(self, args: List[Union[PathLike, 'Diffable', Type['Diffable.Index']]] - ) -> List[Union[PathLike, 'Diffable', Type['Diffable.Index']]]: + def _process_diff_args(self, args: List[Union[str, 'Diffable', Type['Diffable.Index'], object]] + ) -> List[Union[str, 'Diffable', Type['Diffable.Index'], object]]: """ :return: possibly altered version of the given args list. @@ -91,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', 'Commit', None, str] = Index, # object for git.NULL_TREE + def diff(self, other: Union[Type['Index'], 'Tree', 'Commit', None, str, object] = Index, 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 @@ -124,7 +124,7 @@ class Diffable(object): :note: On a bare repository, 'other' needs to be provided as Index or as as Tree/Commit, or a git command error will occur""" - args: List[Union[PathLike, Diffable, Type['Diffable.Index']]] = [] + args: List[Union[PathLike, Diffable, Type['Diffable.Index'], object]] = [] args.append("--abbrev=40") # we need full shas args.append("--full-index") # get full index paths, not only filenames diff --git a/git/index/base.py b/git/index/base.py index 75df5184..6f6ea5aa 100644 --- a/git/index/base.py +++ b/git/index/base.py @@ -575,8 +575,9 @@ class IndexFile(LazyMixin, git_diff.Diffable, Serializable): root_tree._cache = tree_items # type: ignore return root_tree - def _process_diff_args(self, args: List[Union[PathLike, 'git_diff.Diffable', Type['git_diff.Diffable.Index']]] - ) -> List[Union[PathLike, 'git_diff.Diffable', Type['git_diff.Diffable.Index']]]: + def _process_diff_args(self, # type: ignore[override] + args: List[Union[str, 'git_diff.Diffable', Type['git_diff.Diffable.Index']]] + ) -> List[Union[str, 'git_diff.Diffable', Type['git_diff.Diffable.Index']]]: try: args.pop(args.index(self)) except IndexError: @@ -1272,9 +1273,8 @@ class IndexFile(LazyMixin, git_diff.Diffable, Serializable): return self # @ default_index, breaks typing for some reason, copied into function - def diff(self, - other: Union[Type['git_diff.Diffable.Index'], 'IndexFile.Index', - 'Tree', 'Commit', str, None] = git_diff.Diffable.Index, + def diff(self, # type: ignore[override] + other: Union[Type['git_diff.Diffable.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: |