@@ -335,7 +335,7 @@ def _write_git_file_and_module_config(cls, working_tree_dir, module_abspath):
335335
336336 @classmethod
337337 def 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"""
@@ -435,6 +437,8 @@ def add(cls, repo: 'Repo', name: str, path: PathLike, url: Union[str, None] = No
435437 kwargs ['depth' ] = depth
436438 else :
437439 raise 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):
440444 mrepo = 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
469473 return sm
470474
471475 def 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=
566572 progress .update (BEGIN | CLONE , 0 , 1 , prefix + "Cloning url '%s' to '%s' in submodule %r" %
567573 (self .url , checkout_module_abspath , self .name ))
568574 if 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
571578 progress .update (END | CLONE , 0 , 1 , prefix + "Done cloning to %s" % checkout_module_abspath )
572579
0 commit comments