@@ -474,8 +474,8 @@ def add(cls, repo: 'Repo', name: str, path: PathLike, url: Union[str, None] = No
474474 sm ._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
479479 index .add ([sm ], write = True )
480480
481481 return sm
@@ -652,7 +652,7 @@ def update(self, recursive: bool = False, init: bool = True, to_latest_revision:
652652 may_reset = True
653653 if mrepo .head .commit .binsha != self .NULL_BIN_SHA :
654654 base_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
656656 if force :
657657 msg = "Will force checkout or reset on local branch that is possibly in the future of"
658658 msg += "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,
927927 import gc
928928 gc .collect ()
929929 try :
930- rmtree (str (wtd ))
930+ rmtree (wtd ) # type: ignore ## str()?
931931 except Exception as ex :
932932 if HIDE_WINDOWS_KNOWN_ERRORS :
933933 raise 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
10171017 try :
1018- self .binsha = pctree [str ( self .path ) ].binsha
1018+ self .binsha = pctree [self .path ].binsha # type: ignore # str()?
10191019 except KeyError :
10201020 self .binsha = self .NULL_BIN_SHA
10211021 # end
@@ -1080,7 +1080,7 @@ def rename(self, new_name: str) -> 'Submodule':
10801080 destination_module_abspath = self ._module_abspath (self .repo , self .path , new_name )
10811081 source_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()?
10841084 tmp_dir = self ._module_abspath (self .repo , self .path , str (uuid .uuid4 ()))
10851085 os .renames (source_dir , tmp_dir )
10861086 source_dir = tmp_dir
0 commit comments