Skip to content

Commit afd2ec5

Browse files
committed
Add type to symbolicreference.delete()
1 parent a8ee94b commit afd2ec5

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

git/refs/symbolic.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ def log_entry(self, index):
421421
return RefLog.entry_at(RefLog.path(self), index)
422422

423423
@classmethod
424-
def to_full_path(cls, path) -> PathLike:
424+
def to_full_path(cls, path: Union[PathLike, 'SymbolicReference']) -> PathLike:
425425
"""
426426
:return: string with a full repository-relative path which can be used to initialize
427427
a Reference instance, for instance by using ``Reference.from_path``"""
@@ -430,12 +430,12 @@ def to_full_path(cls, path) -> PathLike:
430430
full_ref_path = path
431431
if not cls._common_path_default:
432432
return full_ref_path
433-
if not path.startswith(cls._common_path_default + "/"):
433+
if not str(path).startswith(cls._common_path_default + "/"):
434434
full_ref_path = '%s/%s' % (cls._common_path_default, path)
435435
return full_ref_path
436436

437437
@classmethod
438-
def delete(cls, repo, path):
438+
def delete(cls, repo: 'Repo', path: PathLike) -> None:
439439
"""Delete the reference at the given path
440440
441441
:param repo:
@@ -457,8 +457,8 @@ def delete(cls, repo, path):
457457
new_lines = []
458458
made_change = False
459459
dropped_last_line = False
460-
for line in reader:
461-
line = line.decode(defenc)
460+
for line_bytes in reader:
461+
line = line_bytes.decode(defenc)
462462
_, _, line_ref = line.partition(' ')
463463
line_ref = line_ref.strip()
464464
# keep line if it is a comment or if the ref to delete is not

0 commit comments

Comments
 (0)