@@ -316,7 +316,8 @@ def _write_git_file_and_module_config(cls, working_tree_dir, module_abspath):
316
316
#{ Edit Interface
317
317
318
318
@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 ):
320
321
"""Add a new submodule to the given repository. This will alter the index
321
322
as well as the .gitmodules file, but will not create a new commit.
322
323
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
349
350
and is defined in `os.environ`, value from `os.environ` will be used.
350
351
If you want to unset some variable, consider providing empty string
351
352
as its value.
353
+ :param clone_multi_options: A list of Clone options. Please see ``git.repo.base.Repo.clone``
354
+ for details.
352
355
:return: The newly created submodule instance
353
356
:note: works atomically, such that no change will be done if the repository
354
357
update fails for instance"""
@@ -415,6 +418,8 @@ def add(cls, repo, name, path, url=None, branch=None, no_checkout=False, depth=N
415
418
kwargs ['depth' ]= depth
416
419
else :
417
420
raise ValueError ("depth should be an integer" )
421
+ if clone_multi_options :
422
+ kwargs ['multi_options' ]= clone_multi_options
418
423
419
424
# _clone_repo(cls, repo, url, path, name, **kwargs):
420
425
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
449
454
return sm
450
455
451
456
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 ):
453
458
"""Update the repository of this submodule to point to the checkout
454
459
we point at with the binsha of this instance.
455
460
@@ -480,6 +485,8 @@ def update(self, recursive=False, init=True, to_latest_revision=False, progress=
480
485
and is defined in `os.environ`, value from `os.environ` will be used.
481
486
If you want to unset some variable, consider providing empty string
482
487
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.
483
490
:note: does nothing in bare repositories
484
491
:note: method is definitely not atomic if recurisve is True
485
492
:return: self"""
@@ -546,7 +553,8 @@ def update(self, recursive=False, init=True, to_latest_revision=False, progress=
546
553
progress .update (BEGIN | CLONE ,0 ,1 ,prefix + "Cloning url '%s' to '%s' in submodule %r" %
547
554
(self .url ,checkout_module_abspath ,self .name ))
548
555
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 )
550
558
# END handle dry-run
551
559
progress .update (END | CLONE ,0 ,1 ,prefix + "Done cloning to %s" % checkout_module_abspath )
552
560