@@ -474,8 +474,8 @@ def add(cls, repo: 'Repo', name: str, path: PathLike, url: Union[str, None] = No
474474sm ._branch_path = br .path
475475
476476# we deliberately assume that our head matches our index !
477- if mrepo is not None :
478- sm .binsha = mrepo .head .commit .binsha
477+ mrepo = cast ( 'Repo' , mrepo )
478+ sm .binsha = mrepo .head .commit .binsha
479479index .add ([sm ],write = True )
480480
481481return sm
@@ -652,7 +652,7 @@ def update(self, recursive: bool = False, init: bool = True, to_latest_revision:
652652may_reset = True
653653if mrepo .head .commit .binsha != self .NULL_BIN_SHA :
654654base_commit = mrepo .merge_base (mrepo .head .commit ,hexsha )
655- if len (base_commit )== 0 or ( base_commit [0 ]is not None and base_commit [ 0 ] .hexsha == hexsha ):
655+ if len (base_commit )== 0 or base_commit [0 ].hexsha == hexsha : # type: ignore
656656if force :
657657msg = "Will force checkout or reset on local branch that is possibly in the future of"
658658msg += "the commit it will be checked out to, effectively 'forgetting' new commits"
@@ -927,7 +927,7 @@ def remove(self, module: bool = True, force: bool = False,
927927import gc
928928gc .collect ()
929929try :
930- rmtree (str (wtd ))
930+ rmtree (wtd ) # type: ignore ## str()?
931931except Exception as ex :
932932if HIDE_WINDOWS_KNOWN_ERRORS :
933933raise SkipTest ("FIXME: fails with: PermissionError\n {}" .format (ex ))from ex
@@ -1015,7 +1015,7 @@ def set_parent_commit(self, commit: Union[Commit_ish, None], check: bool = True)
10151015# If check is False, we might see a parent-commit that doesn't even contain the submodule anymore.
10161016# in that case, mark our sha as being NULL
10171017try :
1018- self .binsha = pctree [str ( self .path ) ].binsha
1018+ self .binsha = pctree [self .path ].binsha # type: ignore # str()?
10191019except KeyError :
10201020self .binsha = self .NULL_BIN_SHA
10211021# end
@@ -1080,7 +1080,7 @@ def rename(self, new_name: str) -> 'Submodule':
10801080destination_module_abspath = self ._module_abspath (self .repo ,self .path ,new_name )
10811081source_dir = mod .git_dir
10821082# Let's be sure the submodule name is not so obviously tied to a directory
1083- if str ( destination_module_abspath ) .startswith (str (mod .git_dir )):
1083+ if destination_module_abspath .startswith (str (mod .git_dir )):# type: ignore # str()?
10841084tmp_dir = self ._module_abspath (self .repo ,self .path ,str (uuid .uuid4 ()))
10851085os .renames (source_dir ,tmp_dir )
10861086source_dir = tmp_dir