57
57
if TYPE_CHECKING :
58
58
from git .index import IndexFile
59
59
from git .repo import Repo
60
+ from git .refs import Head
60
61
61
62
62
63
# -----------------------------------------------------------------------------
@@ -265,7 +266,7 @@ def _module_abspath(cls, parent_repo: 'Repo', path: PathLike, name: str) -> Path
265
266
# end
266
267
267
268
@classmethod
268
- def _clone_repo (cls , repo , url , path , name , ** kwargs ) :
269
+ def _clone_repo (cls , repo : 'Repo' , url : str , path : PathLike , name : str , ** kwargs : Any ) -> 'Repo' :
269
270
""":return: Repo instance of newly cloned repository
270
271
:param repo: our parent repository
271
272
:param url: url to clone from
@@ -279,7 +280,7 @@ def _clone_repo(cls, repo, url, path, name, **kwargs):
279
280
module_abspath_dir = osp .dirname (module_abspath )
280
281
if not osp .isdir (module_abspath_dir ):
281
282
os .makedirs (module_abspath_dir )
282
- module_checkout_path = osp .join (repo .working_tree_dir , path )
283
+ module_checkout_path = osp .join (str ( repo .working_tree_dir ) , path )
283
284
# end
284
285
285
286
clone = git .Repo .clone_from (url , module_checkout_path , ** kwargs )
@@ -484,7 +485,7 @@ def add(cls, repo: 'Repo', name: str, path: PathLike, url: Union[str, None] = No
484
485
def update (self , recursive : bool = False , init : bool = True , to_latest_revision : bool = False ,
485
486
progress : Union ['UpdateProgress' , None ] = None , dry_run : bool = False ,
486
487
force : bool = False , keep_going : bool = False , env : Union [Mapping [str , str ], None ] = None ,
487
- clone_multi_options : Union [Sequence [TBD ], None ] = None ):
488
+ clone_multi_options : Union [Sequence [TBD ], None ] = None ) -> 'Submodule' :
488
489
"""Update the repository of this submodule to point to the checkout
489
490
we point at with the binsha of this instance.
490
491
@@ -712,7 +713,7 @@ def update(self, recursive: bool = False, init: bool = True, to_latest_revision:
712
713
return self
713
714
714
715
@unbare_repo
715
- def move (self , module_path , configuration = True , module = True ):
716
+ def move (self , module_path : PathLike , configuration : bool = True , module : bool = True ) -> 'Submodule' :
716
717
"""Move the submodule to a another module path. This involves physically moving
717
718
the repository at our current path, changing the configuration, as well as
718
719
adjusting our index entry accordingly.
@@ -742,7 +743,7 @@ def move(self, module_path, configuration=True, module=True):
742
743
return self
743
744
# END handle no change
744
745
745
- module_checkout_abspath = join_path_native (self .repo .working_tree_dir , module_checkout_path )
746
+ module_checkout_abspath = join_path_native (str ( self .repo .working_tree_dir ) , module_checkout_path )
746
747
if osp .isfile (module_checkout_abspath ):
747
748
raise ValueError ("Cannot move repository onto a file: %s" % module_checkout_abspath )
748
749
# END handle target files
@@ -1160,7 +1161,7 @@ def exists(self) -> bool:
1160
1161
# END handle object state consistency
1161
1162
1162
1163
@property
1163
- def branch (self ):
1164
+ def branch (self ) -> 'Head' :
1164
1165
""":return: The branch instance that we are to checkout
1165
1166
:raise InvalidGitRepositoryError: if our module is not yet checked out"""
1166
1167
return mkhead (self .module (), self ._branch_path )
0 commit comments