summaryrefslogtreecommitdiff
path: root/git/refs
diff options
context:
space:
mode:
authorYobmod <yobmod@gmail.com>2021-07-31 17:02:53 +0100
committerYobmod <yobmod@gmail.com>2021-07-31 17:02:53 +0100
commitafd2ec5251479f48044408c7fcb7dab0494cd4c1 (patch)
treef13f6c470aeab3c9900d2718b7770d9be8270c10 /git/refs
parenta8ee94b1998589085ae2b8a6de310d0a5dfd0ffd (diff)
downloadgitpython-afd2ec5251479f48044408c7fcb7dab0494cd4c1.tar.gz
Add type to symbolicreference.delete()
Diffstat (limited to 'git/refs')
-rw-r--r--git/refs/symbolic.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/git/refs/symbolic.py b/git/refs/symbolic.py
index 1000204f..89999eda 100644
--- a/git/refs/symbolic.py
+++ b/git/refs/symbolic.py
@@ -421,7 +421,7 @@ class SymbolicReference(object):
return RefLog.entry_at(RefLog.path(self), index)
@classmethod
- def to_full_path(cls, path) -> PathLike:
+ def to_full_path(cls, path: Union[PathLike, 'SymbolicReference']) -> PathLike:
"""
:return: string with a full repository-relative path which can be used to initialize
a Reference instance, for instance by using ``Reference.from_path``"""
@@ -430,12 +430,12 @@ class SymbolicReference(object):
full_ref_path = path
if not cls._common_path_default:
return full_ref_path
- if not path.startswith(cls._common_path_default + "/"):
+ if not str(path).startswith(cls._common_path_default + "/"):
full_ref_path = '%s/%s' % (cls._common_path_default, path)
return full_ref_path
@classmethod
- def delete(cls, repo, path):
+ def delete(cls, repo: 'Repo', path: PathLike) -> None:
"""Delete the reference at the given path
:param repo:
@@ -457,8 +457,8 @@ class SymbolicReference(object):
new_lines = []
made_change = False
dropped_last_line = False
- for line in reader:
- line = line.decode(defenc)
+ for line_bytes in reader:
+ line = line_bytes.decode(defenc)
_, _, line_ref = line.partition(' ')
line_ref = line_ref.strip()
# keep line if it is a comment or if the ref to delete is not