diff options
author | Sebastian Thiel <sebastian.thiel@icloud.com> | 2021-07-01 07:53:56 +0800 |
---|---|---|
committer | Sebastian Thiel <sebastian.thiel@icloud.com> | 2021-07-01 07:53:56 +0800 |
commit | e5f2528071f2e1f43a02431c723a19929e68f157 (patch) | |
tree | f43c9630cf31fde5d9bd9d8a9afc9d45103cc0ef /git/objects/submodule/base.py | |
parent | 8fd5414697724feff782e952a42ca5d9651418bc (diff) | |
parent | 8ad4f5923e7df65a4ad30a527ab10abc88f74f64 (diff) | |
download | gitpython-e5f2528071f2e1f43a02431c723a19929e68f157.tar.gz |
Merge branch 'main' into Yobmod/main
Diffstat (limited to 'git/objects/submodule/base.py')
-rw-r--r-- | git/objects/submodule/base.py | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/git/objects/submodule/base.py b/git/objects/submodule/base.py index 9b6ef6eb..68e16b5f 100644 --- a/git/objects/submodule/base.py +++ b/git/objects/submodule/base.py @@ -335,7 +335,7 @@ class Submodule(IndexObject, TraversableIterableObj): @classmethod def add(cls, repo: 'Repo', name: str, path: PathLike, url: Union[str, None] = None, - branch=None, no_checkout: bool = False, depth=None, env=None + branch=None, no_checkout: bool = False, depth=None, env=None, clone_multi_options=None ) -> 'Submodule': """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. @@ -369,6 +369,8 @@ class Submodule(IndexObject, TraversableIterableObj): 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""" @@ -435,6 +437,8 @@ class Submodule(IndexObject, TraversableIterableObj): 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) @@ -469,7 +473,7 @@ class Submodule(IndexObject, TraversableIterableObj): 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. @@ -500,6 +504,8 @@ class Submodule(IndexObject, TraversableIterableObj): 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""" @@ -566,7 +572,8 @@ class Submodule(IndexObject, TraversableIterableObj): 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) |