@@ -289,7 +289,8 @@ def _get_reference(self):
289289raise TypeError ("%s is a detached symbolic reference as it points to %r" % (self ,sha ))
290290return self .from_path (self .repo ,target_ref_path )
291291
292- def set_reference (self ,ref ,logmsg = None ):
292+ def set_reference (self ,ref :Union [Commit_ish ,'SymbolicReference' ,str ],
293+ logmsg :Union [str ,None ]= None )-> Union [Commit_ish ,'SymbolicReference' ]:
293294"""Set ourselves to the given ref. It will stay a symbol if the ref is a Reference.
294295 Otherwise an Object, given as Object instance or refspec, is assumed and if valid,
295296 will be set which effectively detaches the refererence if it was a purely
@@ -330,7 +331,7 @@ def set_reference(self, ref, logmsg=None):
330331raise TypeError ("Require commit, got %r" % obj )
331332# END verify type
332333
333- oldbinsha = None
334+ oldbinsha : bytes = b''
334335if logmsg is not None :
335336try :
336337oldbinsha = self .commit .binsha
@@ -359,8 +360,8 @@ def set_reference(self, ref, logmsg=None):
359360return self
360361
361362# aliased reference
362- reference = property (_get_reference ,set_reference ,doc = "Returns the Reference we point to" )
363- ref :Union ['Reference' ]= reference # type: ignore
363+ reference = property (_get_reference ,set_reference ,doc = "Returns the Reference we point to" )# type: ignore
364+ ref :Union ['Reference' ]= reference # type: ignore
364365
365366def is_valid (self )-> bool :
366367"""