diff options
author | Russ Allbery <eagle@eyrie.org> | 2021-09-20 13:53:42 -0700 |
---|---|---|
committer | Russ Allbery <eagle@eyrie.org> | 2021-09-20 15:03:45 -0700 |
commit | 5f4b4dbff46fae4c899f5573aea5a7266a41eeeb (patch) | |
tree | cd6d4a755c41c203b6d1c14996d0025318579efc /git/repo/base.py | |
parent | 2d15c5a601e698e8f7859e821950cad0701b756d (diff) | |
download | gitpython-5f4b4dbff46fae4c899f5573aea5a7266a41eeeb.tar.gz |
Fix typing issues with delete_head and Remote.add
delete_head and Head.delete historically accept either Head objects
or a str name of a head. Adjust the typing to match. This
unfortunately requires suppressing type warnings in the signature of
RemoteReference.delete, since it inherits from Head but does not
accept str (since it needs access to the richer data of
RemoteReference).
Using assignment to make add an alias for create unfortunately
confuses mypy, since it loses track of the fact that it's a
classmethod and starts treating it like a staticmethod. Replace
with a stub wrapper instead.
Diffstat (limited to 'git/repo/base.py')
-rw-r--r-- | git/repo/base.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/git/repo/base.py b/git/repo/base.py index e308fd8a..7713c915 100644 --- a/git/repo/base.py +++ b/git/repo/base.py @@ -429,7 +429,7 @@ class Repo(object): :return: newly created Head Reference""" return Head.create(self, path, commit, logmsg, force) - def delete_head(self, *heads: 'Head', **kwargs: Any) -> None: + def delete_head(self, *heads: 'Union[str, Head]', **kwargs: Any) -> None: """Delete the given heads :param kwargs: Additional keyword arguments to be passed to git-branch""" |