2626
2727if TYPE_CHECKING:
2828 from git.repo import Repo
29+ from git.refs import Head, TagReference, Reference
2930
3031T_References = TypeVar('T_References', bound='SymbolicReference')
3132
@@ -59,10 +60,10 @@ class SymbolicReference(object):
5960
6061 def __init__(self, repo: 'Repo', path: PathLike, check_path: bool = False):
6162 self.repo = repo
62- self.path = str( path)
63+ self.path = path
6364
6465 def __str__(self) -> str:
65- return self.path
66+ return str( self.path)
6667
6768 def __repr__(self):
6869 return '<git.%s "%s">' % (self.__class__.__name__, self.path)
@@ -84,7 +85,7 @@ def name(self) -> str:
8485 :return:
8586 In case of symbolic references, the shortest assumable name
8687 is the path itself."""
87- return self.path
88+ return str( self.path)
8889
8990 @property
9091 def abspath(self) -> PathLike:
@@ -557,7 +558,7 @@ def create(cls, repo: 'Repo', path: PathLike, reference: Union[Commit_ish, str]
557558 :note: This does not alter the current HEAD, index or Working Tree"""
558559 return cls._create(repo, path, cls._resolve_ref_on_create, reference, force, logmsg)
559560
560- def rename(self, new_path, force= False):
561+ def rename(self, new_path: PathLike , force: bool = False) -> 'SymbolicReference' :
561562 """Rename self to a new path
562563
563564 :param new_path:
@@ -577,7 +578,7 @@ def rename(self, new_path, force=False):
577578
578579 new_abs_path = os.path.join(_git_dir(self.repo, new_path), new_path)
579580 cur_abs_path = os.path.join(_git_dir(self.repo, self.path), self.path)
580- if os.path.path. isfile(new_abs_path):
581+ if os.path.isfile(new_abs_path):
581582 if not force:
582583 # if they point to the same file, its not an error
583584 with open(new_abs_path, 'rb') as fd1:
@@ -663,7 +664,7 @@ def iter_items(cls: Type[T_References], repo: 'Repo', common_path: Union[PathLik
663664 return (r for r in cls._iter_items(repo, common_path) if r.__class__ == SymbolicReference or not r.is_detached)
664665
665666 @classmethod
666- def from_path(cls, repo, path) :
667+ def from_path(cls, repo: 'Repo' , path: PathLike) -> Union['Head', 'TagReference', 'Reference'] :
667668 """
668669 :param path: full .git-directory-relative path name to the Reference to instantiate
669670 :note: use to_full_path() if you only have a partial path of a known Reference Type
0 commit comments