@@ -289,7 +289,8 @@ def _get_reference(self):
289
289
raise TypeError ("%s is a detached symbolic reference as it points to %r" % (self , sha ))
290
290
return self .from_path (self .repo , target_ref_path )
291
291
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' ]:
293
294
"""Set ourselves to the given ref. It will stay a symbol if the ref is a Reference.
294
295
Otherwise an Object, given as Object instance or refspec, is assumed and if valid,
295
296
will be set which effectively detaches the refererence if it was a purely
@@ -330,7 +331,7 @@ def set_reference(self, ref, logmsg=None):
330
331
raise TypeError ("Require commit, got %r" % obj )
331
332
# END verify type
332
333
333
- oldbinsha = None
334
+ oldbinsha : bytes = b''
334
335
if logmsg is not None :
335
336
try :
336
337
oldbinsha = self .commit .binsha
@@ -359,8 +360,8 @@ def set_reference(self, ref, logmsg=None):
359
360
return self
360
361
361
362
# 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
364
365
365
366
def is_valid (self ) -> bool :
366
367
"""
0 commit comments