Make sure that multi-options are checked after splitting them with `shlex` by Byron · Pull Request #2130 · gitpython-developers/GitPython · GitHub
Skip to content
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
4 changes: 2 additions & 2 deletions git/repo/base.py
18 changes: 18 additions & 0 deletions test/test_clone.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,15 @@ def test_clone_unsafe_options(self, rw_repo):
rw_repo.clone(tmp_dir, **unsafe_option)
assert not tmp_file.exists()

@with_rw_repo("HEAD")
def test_clone_unsafe_options_are_checked_after_splitting_multi_options(self, rw_repo):
with tempfile.TemporaryDirectory() as tdir:
tmp_dir = pathlib.Path(tdir)
payload = "--single-branch --config protocol.ext.allow=always"

with self.assertRaises(UnsafeOptionError):
rw_repo.clone(tmp_dir, multi_options=[payload])

@pytest.mark.xfail(
sys.platform == "win32",
reason=(
Expand Down Expand Up @@ -216,6 +225,15 @@ def test_clone_from_unsafe_options(self, rw_repo):
Repo.clone_from(rw_repo.working_dir, tmp_dir, **unsafe_option)
assert not tmp_file.exists()

@with_rw_repo("HEAD")
def test_clone_from_unsafe_options_are_checked_after_splitting_multi_options(self, rw_repo):
with tempfile.TemporaryDirectory() as tdir:
tmp_dir = pathlib.Path(tdir)
payload = "--single-branch --config protocol.ext.allow=always"

with self.assertRaises(UnsafeOptionError):
Repo.clone_from(rw_repo.working_dir, tmp_dir, multi_options=[payload])

@pytest.mark.xfail(
sys.platform == "win32",
reason=(
Expand Down
11 changes: 11 additions & 0 deletions test/test_submodule.py
Loading