diff options
author | Yobmod <yobmod@gmail.com> | 2021-07-28 21:50:49 +0100 |
---|---|---|
committer | Yobmod <yobmod@gmail.com> | 2021-07-28 21:50:49 +0100 |
commit | adc00dd1773ee1b532803b2272cc989f11e09f8a (patch) | |
tree | 72bd977e1313e09bb7e4957ec600b0a6ed076694 /git/refs/head.py | |
parent | 070f5c0d1f06d3e15ec5aa841b96fa2a1fdb7bf4 (diff) | |
download | gitpython-adc00dd1773ee1b532803b2272cc989f11e09f8a.tar.gz |
Fix more missing types in Symbolic.py, cos GuthubActions pytest stuck
Diffstat (limited to 'git/refs/head.py')
-rw-r--r-- | git/refs/head.py | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/git/refs/head.py b/git/refs/head.py index 4b9bf33c..260bf5e7 100644 --- a/git/refs/head.py +++ b/git/refs/head.py @@ -1,4 +1,4 @@ -from git.config import SectionConstraint +from git.config import GitConfigParser, SectionConstraint from git.util import join_path from git.exc import GitCommandError @@ -203,7 +203,7 @@ class Head(Reference): self.path = "%s/%s" % (self._common_path_default, new_path) return self - def checkout(self, force: bool = False, **kwargs: Any): + def checkout(self, force: bool = False, **kwargs: Any) -> Union['HEAD', 'Head']: """Checkout this head by setting the HEAD to this reference, by updating the index to reflect the tree we point to and by updating the working tree to reflect the latest index. @@ -235,10 +235,11 @@ class Head(Reference): self.repo.git.checkout(self, **kwargs) if self.repo.head.is_detached: return self.repo.head - return self.repo.active_branch + else: + return self.repo.active_branch #{ Configuration - def _config_parser(self, read_only: bool) -> SectionConstraint: + def _config_parser(self, read_only: bool) -> SectionConstraint[GitConfigParser]: if read_only: parser = self.repo.config_reader() else: @@ -247,13 +248,13 @@ class Head(Reference): return SectionConstraint(parser, 'branch "%s"' % self.name) - def config_reader(self) -> SectionConstraint: + def config_reader(self) -> SectionConstraint[GitConfigParser]: """ :return: A configuration parser instance constrained to only read this instance's values""" return self._config_parser(read_only=True) - def config_writer(self) -> SectionConstraint: + def config_writer(self) -> SectionConstraint[GitConfigParser]: """ :return: A configuration writer instance with read-and write access to options of this head""" |