Skip to content

Commit 3be955e

Browse files
committed
Add type to symbolicreference.references()
1 parent 13b38ce commit 3be955e

File tree

2 files changed

+3
-12
lines changed

2 files changed

+3
-12
lines changed

git/refs/head.py

-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ def __init__(self, repo: 'Repo', path: PathLike = _HEAD_NAME):
4040
raise ValueError("HEAD instance must point to %r, got %r" % (self._HEAD_NAME, path))
4141
super(HEAD, self).__init__(repo, path)
4242
self.commit: 'Commit'
43-
self.ref: 'Head'
4443

4544
def orig_head(self) -> SymbolicReference:
4645
"""

git/refs/symbolic.py

+3-11
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
if TYPE_CHECKING:
2828
from git.repo import Repo
29-
from git.refs import Head, TagReference, Reference
29+
from git.refs import Head, TagReference, RemoteReference, Reference
3030
from .log import RefLogEntry
3131
from git.config import GitConfigParser
3232
from git.objects.commit import Actor
@@ -65,7 +65,6 @@ class SymbolicReference(object):
6565
def __init__(self, repo: 'Repo', path: PathLike, check_path: bool = False):
6666
self.repo = repo
6767
self.path = path
68-
self.ref = self.reference
6968

7069
def __str__(self) -> str:
7170
return str(self.path)
@@ -363,15 +362,8 @@ def set_reference(self, ref: Union[Commit_ish, 'SymbolicReference', str],
363362
return self
364363

365364
# aliased reference
366-
# reference = property(_get_reference, set_reference, doc="Returns the Reference we point to") # type: ignore
367-
368-
@property
369-
def reference(self) -> 'Reference':
370-
return self._get_reference()
371-
372-
@reference.setter
373-
def reference(self, *args, **kwargs):
374-
return self.set_reference(*args, **kwargs)
365+
reference = property(_get_reference, set_reference, doc="Returns the Reference we point to") # type: ignore
366+
ref: Union['Head', 'TagReference', 'RemoteReference', 'Reference'] = reference # type: ignore
375367

376368
def is_valid(self) -> bool:
377369
"""

0 commit comments

Comments
 (0)