@@ -335,7 +335,7 @@ def _write_git_file_and_module_config(cls, working_tree_dir, module_abspath):
335335
336336@classmethod
337337def add (cls ,repo :'Repo' ,name :str ,path :PathLike ,url :Union [str ,None ]= None ,
338- branch = None ,no_checkout :bool = False ,depth = None ,env = None
338+ branch = None ,no_checkout :bool = False ,depth = None ,env = None , clone_multi_options = None
339339 )-> 'Submodule' :
340340"""Add a new submodule to the given repository. This will alter the index
341341 as well as the .gitmodules file, but will not create a new commit.
@@ -369,6 +369,8 @@ def add(cls, repo: 'Repo', name: str, path: PathLike, url: Union[str, None] = No
369369 and is defined in `os.environ`, value from `os.environ` will be used.
370370 If you want to unset some variable, consider providing empty string
371371 as its value.
372+ :param clone_multi_options: A list of Clone options. Please see ``git.repo.base.Repo.clone``
373+ for details.
372374 :return: The newly created submodule instance
373375 :note: works atomically, such that no change will be done if the repository
374376 update fails for instance"""
@@ -381,15 +383,15 @@ def add(cls, repo: 'Repo', name: str, path: PathLike, url: Union[str, None] = No
381383# assure we never put backslashes into the url, as some operating systems
382384# like it ...
383385if url is not None :
384- url = to_native_path_linux (url )# to_native_path_linux does nothing??
386+ url = to_native_path_linux (url )
385387# END assure url correctness
386388
387389# INSTANTIATE INTERMEDIATE SM
388390sm = cls (repo ,cls .NULL_BIN_SHA ,cls .k_default_mode ,path ,name ,url = 'invalid-temporary' )
389391if sm .exists ():
390392# reretrieve submodule from tree
391393try :
392- sm = repo .head .commit .tree [path ]# type: ignore
394+ sm = repo .head .commit .tree [path ]
393395sm ._name = name
394396return sm
395397except KeyError :
@@ -435,6 +437,8 @@ def add(cls, repo: 'Repo', name: str, path: PathLike, url: Union[str, None] = No
435437kwargs ['depth' ]= depth
436438else :
437439raise ValueError ("depth should be an integer" )
440+ if clone_multi_options :
441+ kwargs ['multi_options' ]= clone_multi_options
438442
439443# _clone_repo(cls, repo, url, path, name, **kwargs):
440444mrepo = cls ._clone_repo (repo ,url ,path ,name ,env = env ,** kwargs )
@@ -469,7 +473,7 @@ def add(cls, repo: 'Repo', name: str, path: PathLike, url: Union[str, None] = No
469473return sm
470474
471475def update (self ,recursive = False ,init = True ,to_latest_revision = False ,progress = None ,dry_run = False ,
472- force = False ,keep_going = False ,env = None ):
476+ force = False ,keep_going = False ,env = None , clone_multi_options = None ):
473477"""Update the repository of this submodule to point to the checkout
474478 we point at with the binsha of this instance.
475479
@@ -500,6 +504,8 @@ def update(self, recursive=False, init=True, to_latest_revision=False, progress=
500504 and is defined in `os.environ`, value from `os.environ` will be used.
501505 If you want to unset some variable, consider providing empty string
502506 as its value.
507+ :param clone_multi_options: list of Clone options. Please see ``git.repo.base.Repo.clone``
508+ for details. Only take effect with `init` option.
503509 :note: does nothing in bare repositories
504510 :note: method is definitely not atomic if recurisve is True
505511 :return: self"""
@@ -566,7 +572,8 @@ def update(self, recursive=False, init=True, to_latest_revision=False, progress=
566572progress .update (BEGIN | CLONE ,0 ,1 ,prefix + "Cloning url '%s' to '%s' in submodule %r" %
567573 (self .url ,checkout_module_abspath ,self .name ))
568574if not dry_run :
569- mrepo = self ._clone_repo (self .repo ,self .url ,self .path ,self .name ,n = True ,env = env )
575+ mrepo = self ._clone_repo (self .repo ,self .url ,self .path ,self .name ,n = True ,env = env ,
576+ multi_options = clone_multi_options )
570577# END handle dry-run
571578progress .update (END | CLONE ,0 ,1 ,prefix + "Done cloning to %s" % checkout_module_abspath )
572579
@@ -993,7 +1000,7 @@ def set_parent_commit(self, commit: Union[Commit_ish, None], check=True):
9931000# If check is False, we might see a parent-commit that doesn't even contain the submodule anymore.
9941001# in that case, mark our sha as being NULL
9951002try :
996- self .binsha = pctree [self .path ].binsha # type: ignore
1003+ self .binsha = pctree [str ( self .path ) ].binsha
9971004except KeyError :
9981005self .binsha = self .NULL_BIN_SHA
9991006# end