diff options
author | Igor Lakhtenkov <lakhtenkov@gmail.com> | 2021-06-30 12:33:33 +0300 |
---|---|---|
committer | Igor Lakhtenkov <lakhtenkov@gmail.com> | 2021-06-30 12:47:11 +0300 |
commit | ba5717549b32f6b5cee304fdff87cb26b3be688a (patch) | |
tree | 88a86f018ca79989df21a437e55d9bc4fdaa7dca /git | |
parent | 2d2ff037f9f7a9ae33e5f4f6bdb75b669a1af19a (diff) | |
download | gitpython-ba5717549b32f6b5cee304fdff87cb26b3be688a.tar.gz |
Added clone multi_options to Submodule
Diffstat (limited to 'git')
-rw-r--r-- | git/objects/submodule/base.py | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/git/objects/submodule/base.py b/git/objects/submodule/base.py index cbf6cd0d..f0b8babc 100644 --- a/git/objects/submodule/base.py +++ b/git/objects/submodule/base.py @@ -316,7 +316,8 @@ class Submodule(IndexObject, IterableObj, Traversable): #{ Edit Interface @classmethod - def add(cls, repo, name, path, url=None, branch=None, no_checkout=False, depth=None, env=None): + def add(cls, repo, name, path, url=None, branch=None, no_checkout=False, depth=None, env=None, + clone_multi_options=None): """Add a new submodule to the given repository. This will alter the index as well as the .gitmodules file, but will not create a new commit. If the submodule already exists, no matter if the configuration differs @@ -349,6 +350,8 @@ class Submodule(IndexObject, IterableObj, Traversable): and is defined in `os.environ`, value from `os.environ` will be used. If you want to unset some variable, consider providing empty string as its value. + :param clone_multi_options: A list of Clone options. Please see ``git.repo.base.Repo.clone`` + for details. :return: The newly created submodule instance :note: works atomically, such that no change will be done if the repository update fails for instance""" @@ -415,6 +418,8 @@ class Submodule(IndexObject, IterableObj, Traversable): kwargs['depth'] = depth else: raise ValueError("depth should be an integer") + if clone_multi_options: + kwargs['multi_options'] = clone_multi_options # _clone_repo(cls, repo, url, path, name, **kwargs): mrepo = cls._clone_repo(repo, url, path, name, env=env, **kwargs) @@ -449,7 +454,7 @@ class Submodule(IndexObject, IterableObj, Traversable): return sm def update(self, recursive=False, init=True, to_latest_revision=False, progress=None, dry_run=False, - force=False, keep_going=False, env=None): + force=False, keep_going=False, env=None, clone_multi_options=None): """Update the repository of this submodule to point to the checkout we point at with the binsha of this instance. @@ -480,6 +485,8 @@ class Submodule(IndexObject, IterableObj, Traversable): and is defined in `os.environ`, value from `os.environ` will be used. If you want to unset some variable, consider providing empty string as its value. + :param clone_multi_options: list of Clone options. Please see ``git.repo.base.Repo.clone`` + for details. Only take effect with `init` option. :note: does nothing in bare repositories :note: method is definitely not atomic if recurisve is True :return: self""" @@ -546,7 +553,8 @@ class Submodule(IndexObject, IterableObj, Traversable): progress.update(BEGIN | CLONE, 0, 1, prefix + "Cloning url '%s' to '%s' in submodule %r" % (self.url, checkout_module_abspath, self.name)) if not dry_run: - mrepo = self._clone_repo(self.repo, self.url, self.path, self.name, n=True, env=env) + mrepo = self._clone_repo(self.repo, self.url, self.path, self.name, n=True, env=env, + multi_options=clone_multi_options) # END handle dry-run progress.update(END | CLONE, 0, 1, prefix + "Done cloning to %s" % checkout_module_abspath) |