Skip to content

Added support of spaces for clone multi_options #1299

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion git/repo/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import logging
import os
import re
import shlex
import warnings
from gitdb.db.loose import LooseObjectDB

Expand Down Expand Up @@ -1043,7 +1044,7 @@ def _clone(cls, git: 'Git', url: PathLike, path: PathLike, odb_default_type: Typ
kwargs['separate_git_dir'] = Git.polish_url(sep_dir)
multi = None
if multi_options:
multi = ' '.join(multi_options).split(' ')
multi = shlex.split(' '.join(multi_options))
proc = git.clone(multi, Git.polish_url(str(url)), clone_path, with_extended_output=True, as_process=True,
v=True, universal_newlines=True, **add_progress(kwargs, git, progress))
if progress:
Expand Down
4 changes: 3 additions & 1 deletion test/test_repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,11 +218,13 @@ def test_clone_from_pathlib_withConfig(self, rw_dir):
cloned = Repo.clone_from(original_repo.git_dir, pathlib.Path(rw_dir) / "clone_pathlib_withConfig",
multi_options=["--recurse-submodules=repo",
"--config core.filemode=false",
"--config submodule.repo.update=checkout"])
"--config submodule.repo.update=checkout",
"--config filter.lfs.clean='git-lfs clean -- %f'"])

self.assertEqual(cloned.config_reader().get_value('submodule', 'active'), 'repo')
self.assertEqual(cloned.config_reader().get_value('core', 'filemode'), False)
self.assertEqual(cloned.config_reader().get_value('submodule "repo"', 'update'), 'checkout')
self.assertEqual(cloned.config_reader().get_value('filter "lfs"', 'clean'), 'git-lfs clean -- %f')

def test_clone_from_with_path_contains_unicode(self):
with tempfile.TemporaryDirectory() as tmpdir:
Expand Down