summaryrefslogtreecommitdiff
path: root/git/refs/head.py
diff options
context:
space:
mode:
authorRuss Allbery <eagle@eyrie.org>2021-09-20 13:53:42 -0700
committerRuss Allbery <eagle@eyrie.org>2021-09-20 15:03:45 -0700
commit5f4b4dbff46fae4c899f5573aea5a7266a41eeeb (patch)
treecd6d4a755c41c203b6d1c14996d0025318579efc /git/refs/head.py
parent2d15c5a601e698e8f7859e821950cad0701b756d (diff)
downloadgitpython-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/refs/head.py')
-rw-r--r--git/refs/head.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/git/refs/head.py b/git/refs/head.py
index 56a87182..d1d72c7b 100644
--- a/git/refs/head.py
+++ b/git/refs/head.py
@@ -129,7 +129,7 @@ class Head(Reference):
k_config_remote_ref = "merge" # branch to merge from remote
@classmethod
- def delete(cls, repo: 'Repo', *heads: 'Head', force: bool = False, **kwargs: Any) -> None:
+ def delete(cls, repo: 'Repo', *heads: 'Union[Head, str]', force: bool = False, **kwargs: Any) -> None:
"""Delete the given heads
:param force: