GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Block separate git directories during clone by Byron · Pull Request #2210 · gitpython-developers/GitPython

Block separate git directories during clone #2210

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.

Sign up for GitHub

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
Byron merged 1 commit into main from fix-clone-unsafe-option
Aug 10, 2026

Uh oh!

There was an error while loading. Please reload this page.

Merged

Block separate git directories during clone #2210

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
1 commit
Select commit
b68afff
Block separate git directories during clone
Byron Aug 10, 2026
File filter
Filter by extension

Clear filters
Conversations
Failed to load comments.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Jump to
Jump to file
Failed to load files.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Diff view
Diff view

Some comments aren't visible on the classic Files Changed page.

There are no files selected for viewing

10 changes: 10 additions & 0 deletions 10 git/objects/submodule/base.py
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import ntpath
import os
import os.path as osp
import shlex
import stat
import sys
import uuid
Expand Down Expand Up @@ -363,6 +364,15 @@ def _clone_repo(
module_abspath = cls._module_abspath(repo, path, name)
module_checkout_path = module_abspath
if cls._need_gitfile_submodules(repo.git):
if not allow_unsafe_options:
Git.check_unsafe_options(Git._option_candidates([], kwargs), repo.unsafe_git_clone_options)
multi_options = kwargs.get("multi_options")
if multi_options:
Git.check_unsafe_options(
shlex.split(" ".join(cast("Sequence[str]", multi_options))),
repo.unsafe_git_clone_options,
)
allow_unsafe_options = True
kwargs["separate_git_dir"] = module_abspath
module_abspath_dir = osp.dirname(module_abspath)
if not osp.isdir(module_abspath_dir):
Expand Down
2 changes: 2 additions & 0 deletions 2 git/repo/base.py
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,8 @@ class Repo:
"-c",
# Can install hooks that execute during clone:
"--template",
# Redirects the repository metadata to a caller-controlled path:
"--separate-git-dir",
# Fetches from an additional caller-controlled URI:
Comment thread
Byron marked this conversation as resolved.
Resolved

Uh oh!

There was an error while loading. Please reload this page.

"--bundle-uri",
]
Expand Down
4 changes: 4 additions & 0 deletions 4 test/test_clone.py
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ def test_clone_unsafe_options(self, rw_repo):
"-vcprotocol.ext.allow=always",
f"--template={tmp_dir}",
f"--bundle-uri=file://{tmp_dir}",
f"--separate-git-dir={tmp_dir / 'git-dir'}",
]
Comment thread
Byron marked this conversation as resolved.
Resolved

Uh oh!

There was an error while loading. Please reload this page.

for unsafe_option in unsafe_options:
with self.assertRaises(UnsafeOptionError):
Expand All @@ -149,6 +150,7 @@ def test_clone_unsafe_options(self, rw_repo):
{"c": "protocol.ext.allow=always"},
{"template": tmp_dir},
{"bundle_uri": f"file://{tmp_dir}"},
{"separate_git_dir": tmp_dir / "git-dir"},
]
for unsafe_option in unsafe_options:
with self.assertRaises(UnsafeOptionError):
Expand Down Expand Up @@ -258,6 +260,7 @@ def test_clone_from_unsafe_options(self, rw_repo):
"-c protocol.ext.allow=always",
"-cprotocol.ext.allow=always",
"-vcprotocol.ext.allow=always",
f"--separate-git-dir={tmp_dir / 'git-dir'}",
]
for unsafe_option in unsafe_options:
with self.assertRaises(UnsafeOptionError):
Expand All @@ -270,6 +273,7 @@ def test_clone_from_unsafe_options(self, rw_repo):
{"u": f"touch {tmp_file}"},
{"config": "protocol.ext.allow=always"},
{"c": "protocol.ext.allow=always"},
{"separate_git_dir": tmp_dir / "git-dir"},
]
for unsafe_option in unsafe_options:
with self.assertRaises(UnsafeOptionError):
Expand Down
1 change: 1 addition & 0 deletions 1 test/test_submodule.py
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -954,6 +954,7 @@ def test_update_rejects_parent_component_in_name(self, rwdir):
source.working_tree_dir,
osp.join(clone.working_tree_dir, "module"),
separate_git_dir=osp.join(rwdir, "escaped", "module"),
allow_unsafe_options=True,
)
with pytest.raises(ValueError, match="submodule name"):
clone.submodules[0].update(init=True)
Expand Down
Loading
Oops, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.