@@ -316,7 +316,8 @@ def _write_git_file_and_module_config(cls, working_tree_dir, module_abspath):
316316 #{ Edit Interface
317317
318318 @classmethod
319- def add (cls , repo , name , path , url = None , branch = None , no_checkout = False , depth = None , env = None ):
319+ def add (cls , repo , name , path , url = None , branch = None , no_checkout = False , depth = None , env = None ,
320+ clone_multi_options = None ):
320321 """Add a new submodule to the given repository. This will alter the index
321322 as well as the .gitmodules file, but will not create a new commit.
322323 If the submodule already exists, no matter if the configuration differs
@@ -349,6 +350,8 @@ def add(cls, repo, name, path, url=None, branch=None, no_checkout=False, depth=N
349350 and is defined in `os.environ`, value from `os.environ` will be used.
350351 If you want to unset some variable, consider providing empty string
351352 as its value.
353+ :param clone_multi_options: A list of Clone options. Please see ``git.repo.base.Repo.clone``
354+ for details.
352355 :return: The newly created submodule instance
353356 :note: works atomically, such that no change will be done if the repository
354357 update fails for instance"""
@@ -415,6 +418,8 @@ def add(cls, repo, name, path, url=None, branch=None, no_checkout=False, depth=N
415418 kwargs ['depth' ] = depth
416419 else :
417420 raise ValueError ("depth should be an integer" )
421+ if clone_multi_options :
422+ kwargs ['multi_options' ] = clone_multi_options
418423
419424 # _clone_repo(cls, repo, url, path, name, **kwargs):
420425 mrepo = cls ._clone_repo (repo , url , path , name , env = env , ** kwargs )
@@ -449,7 +454,7 @@ def add(cls, repo, name, path, url=None, branch=None, no_checkout=False, depth=N
449454 return sm
450455
451456 def update (self , recursive = False , init = True , to_latest_revision = False , progress = None , dry_run = False ,
452- force = False , keep_going = False , env = None ):
457+ force = False , keep_going = False , env = None , clone_multi_options = None ):
453458 """Update the repository of this submodule to point to the checkout
454459 we point at with the binsha of this instance.
455460
@@ -480,6 +485,8 @@ def update(self, recursive=False, init=True, to_latest_revision=False, progress=
480485 and is defined in `os.environ`, value from `os.environ` will be used.
481486 If you want to unset some variable, consider providing empty string
482487 as its value.
488+ :param clone_multi_options: list of Clone options. Please see ``git.repo.base.Repo.clone``
489+ for details. Only take effect with `init` option.
483490 :note: does nothing in bare repositories
484491 :note: method is definitely not atomic if recurisve is True
485492 :return: self"""
@@ -546,7 +553,8 @@ def update(self, recursive=False, init=True, to_latest_revision=False, progress=
546553 progress .update (BEGIN | CLONE , 0 , 1 , prefix + "Cloning url '%s' to '%s' in submodule %r" %
547554 (self .url , checkout_module_abspath , self .name ))
548555 if not dry_run :
549- mrepo = self ._clone_repo (self .repo , self .url , self .path , self .name , n = True , env = env )
556+ mrepo = self ._clone_repo (self .repo , self .url , self .path , self .name , n = True , env = env ,
557+ multi_options = clone_multi_options )
550558 # END handle dry-run
551559 progress .update (END | CLONE , 0 , 1 , prefix + "Done cloning to %s" % checkout_module_abspath )
552560
0 commit comments