@@ -274,7 +274,7 @@ def set_object(self, object, logmsg=None): # @ReservedAssignment
274274# set the commit on our reference
275275return 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
278278object = property (_get_object ,set_object ,doc = "Return the object our ref currently refers to" )
279279
280280def _get_reference (self ):
@@ -286,7 +286,8 @@ def _get_reference(self):
286286raise TypeError ("%s is a detached symbolic reference as it points to %r" % (self ,sha ))
287287return 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):
327328raise TypeError ("Require commit, got %r" % obj )
328329# END verify type
329330
330- oldbinsha = None
331+ oldbinsha = b''
331332if logmsg is not None :
332333try :
333334oldbinsha = self .commit .binsha
@@ -356,8 +357,8 @@ def set_reference(self, ref, logmsg=None):
356357return 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
362363def is_valid (self ):
363364"""