Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 13b38ce

Browse filesBrowse files
committed
Add type to symbolicreference.reference()
1 parent d4d4669 commit 13b38ce
Copy full SHA for 13b38ce

2 files changed

+12-3Lines changed: 12 additions & 3 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎git/refs/head.py‎

Copy file name to clipboardExpand all lines: git/refs/head.py
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ 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'
4344

4445
def orig_head(self) -> SymbolicReference:
4546
"""
Collapse file

‎git/refs/symbolic.py‎

Copy file name to clipboardExpand all lines: git/refs/symbolic.py
+11-3Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ 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
6869

6970
def __str__(self) -> str:
7071
return str(self.path)
@@ -282,7 +283,7 @@ def set_object(self, object: Union[Commit_ish, 'SymbolicReference', str], logmsg
282283
commit = property(_get_commit, set_commit, doc="Query or set commits directly") # type: ignore
283284
object = property(_get_object, set_object, doc="Return the object our ref currently refers to") # type: ignore
284285

285-
def _get_reference(self) -> 'SymbolicReference':
286+
def _get_reference(self) -> 'Reference':
286287
""":return: Reference Object we point to
287288
:raise TypeError: If this symbolic reference is detached, hence it doesn't point
288289
to a reference, but to a commit"""
@@ -362,8 +363,15 @@ def set_reference(self, ref: Union[Commit_ish, 'SymbolicReference', str],
362363
return self
363364

364365
# aliased reference
365-
reference = property(_get_reference, set_reference, doc="Returns the Reference we point to") # type: ignore
366-
ref: Union['Reference'] = reference # type: ignore
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)
367375

368376
def is_valid(self) -> bool:
369377
"""

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.