Skip to content

Commit

Permalink
Added support of spaces for clone multi_options
Browse files Browse the repository at this point in the history
  • Loading branch information
ilakhtenkov committed Jul 27, 2021
1 parent c5e6ae2 commit 717bfe9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
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

0 comments on commit 717bfe9

Please sign in to comment.