diff options
author | Yobmod <yobmod@gmail.com> | 2021-07-31 17:15:33 +0100 |
---|---|---|
committer | Yobmod <yobmod@gmail.com> | 2021-07-31 17:15:33 +0100 |
commit | e8442eead72bfc2a547234d0289d0f90642167fd (patch) | |
tree | eb7006990ead31bdd97ac268b4aca0a418375f84 /git/refs | |
parent | 7f401fc659a7f9c84a9c88675aba498357a2916d (diff) | |
download | gitpython-e8442eead72bfc2a547234d0289d0f90642167fd.tar.gz |
Add type to symbolicreference.set_reference()
Diffstat (limited to 'git/refs')
-rw-r--r-- | git/refs/symbolic.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/git/refs/symbolic.py b/git/refs/symbolic.py index 65bad6e4..4713e0c4 100644 --- a/git/refs/symbolic.py +++ b/git/refs/symbolic.py @@ -289,7 +289,8 @@ class SymbolicReference(object): raise TypeError("%s is a detached symbolic reference as it points to %r" % (self, sha)) return self.from_path(self.repo, target_ref_path) - def set_reference(self, ref, logmsg=None): + def set_reference(self, ref: Union[Commit_ish, 'SymbolicReference', str], + logmsg: Union[str, None] = None) -> Union[Commit_ish, 'SymbolicReference']: """Set ourselves to the given ref. It will stay a symbol if the ref is a Reference. Otherwise an Object, given as Object instance or refspec, is assumed and if valid, will be set which effectively detaches the refererence if it was a purely @@ -330,7 +331,7 @@ class SymbolicReference(object): raise TypeError("Require commit, got %r" % obj) # END verify type - oldbinsha = None + oldbinsha: bytes = b'' if logmsg is not None: try: oldbinsha = self.commit.binsha @@ -359,8 +360,8 @@ class SymbolicReference(object): return self # aliased reference - reference = property(_get_reference, set_reference, doc="Returns the Reference we point to") - ref: Union['Reference'] = reference # type: ignore + reference = property(_get_reference, set_reference, doc="Returns the Reference we point to") # type: ignore + ref: Union['Reference'] = reference # type: ignore def is_valid(self) -> bool: """ |