@@ -274,7 +274,7 @@ def set_object(self, object, logmsg=None): # @ReservedAssignment
274
274
# set the commit on our reference
275
275
return self ._get_reference ().set_object (object , logmsg )
276
276
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
278
278
object = property (_get_object , set_object , doc = "Return the object our ref currently refers to" )
279
279
280
280
def _get_reference (self ):
@@ -286,7 +286,8 @@ def _get_reference(self):
286
286
raise TypeError ("%s is a detached symbolic reference as it points to %r" % (self , sha ))
287
287
return self .from_path (self .repo , target_ref_path )
288
288
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' :
290
291
"""Set ourselves to the given ref. It will stay a symbol if the ref is a Reference.
291
292
Otherwise an Object, given as Object instance or refspec, is assumed and if valid,
292
293
will be set which effectively detaches the refererence if it was a purely
@@ -327,7 +328,7 @@ def set_reference(self, ref, logmsg=None):
327
328
raise TypeError ("Require commit, got %r" % obj )
328
329
# END verify type
329
330
330
- oldbinsha = None
331
+ oldbinsha = b''
331
332
if logmsg is not None :
332
333
try :
333
334
oldbinsha = self .commit .binsha
@@ -356,8 +357,8 @@ def set_reference(self, ref, logmsg=None):
356
357
return self
357
358
358
359
# 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
361
362
362
363
def is_valid (self ):
363
364
"""
0 commit comments