Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3ecb794

Browse files
authored
Update symbolic.py
1 parent ebe53dd commit 3ecb794

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

git/refs/symbolic.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ def set_object(self, object, logmsg=None): # @ReservedAssignment
274274
# set the commit on our reference
275275
return self._get_reference().set_object(object, logmsg)
276276

277-
commit = property(_get_commit, set_commit, doc="Query or set commits directly")
277+
commit: 'Commit' = property(_get_commit, set_commit, doc="Query or set commits directly") # type: ignore
278278
object = property(_get_object, set_object, doc="Return the object our ref currently refers to")
279279

280280
def _get_reference(self):
@@ -286,7 +286,8 @@ def _get_reference(self):
286286
raise TypeError("%s is a detached symbolic reference as it points to %r" % (self, sha))
287287
return self.from_path(self.repo, target_ref_path)
288288

289-
def set_reference(self, ref, logmsg=None):
289+
def set_reference(self, ref: Union['SymbolicReference', Commit_ish, str],
290+
logmsg: Union[str, None] = None) -> 'SymbolicReference':
290291
"""Set ourselves to the given ref. It will stay a symbol if the ref is a Reference.
291292
Otherwise an Object, given as Object instance or refspec, is assumed and if valid,
292293
will be set which effectively detaches the refererence if it was a purely
@@ -327,7 +328,7 @@ def set_reference(self, ref, logmsg=None):
327328
raise TypeError("Require commit, got %r" % obj)
328329
# END verify type
329330

330-
oldbinsha = None
331+
oldbinsha = b''
331332
if logmsg is not None:
332333
try:
333334
oldbinsha = self.commit.binsha
@@ -356,8 +357,8 @@ def set_reference(self, ref, logmsg=None):
356357
return self
357358

358359
# aliased reference
359-
reference = property(_get_reference, set_reference, doc="Returns the Reference we point to")
360-
ref: Union[Commit_ish] = reference # type: ignore # Union[str, Commit_ish, SymbolicReference]
360+
reference = property(_get_reference, set_reference, doc="Returns the Reference we point to") # type: ignore
361+
ref: Union['Reference', 'Head'] = reference # type: ignore
361362

362363
def is_valid(self):
363364
"""

0 commit comments

Comments
 (0)