| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 0709171 commit 914a4ae
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -419,7 +419,8 @@ def abspath(self) -> PathLike: | |||
| 419 | 419 | path = super().abspath | |
| 420 | 420 | root = self.repo.working_tree_dir | |
| 421 | 421 | assert root is not None | |
| 422 | - _to_relative_path(osp.realpath(root), osp.realpath(path)) | ||
| 422 | + if _to_relative_path(osp.realpath(root), osp.realpath(path)) == ".": | ||
| 423 | + raise ValueError("Submodule checkout path must not be the repository root") | ||
| 423 | 424 | return path | |
| 424 | 425 | ||
| 425 | 426 | @classmethod | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1400,6 +1400,14 @@ def test_update_rejects_checkout_path_through_outside_symlink(self, rwdir): | |||
| 1400 | 1400 | with pytest.raises(ValueError, match="is not in repository"): | |
| 1401 | 1401 | submodule.update(init=True) | |
| 1402 | 1402 | ||
| 1403 | + @with_rw_directory | ||
| 1404 | + def test_update_rejects_checkout_path_at_parent_root(self, rwdir): | ||
| 1405 | + parent = git.Repo.init(osp.join(rwdir, "parent")) | ||
| 1406 | + submodule = Submodule(parent, Submodule.NULL_BIN_SHA, name="module", path=".", url="unused") | ||
| 1407 | + | ||
| 1408 | + with pytest.raises(ValueError, match="must not be the repository root"): | ||
| 1409 | + submodule.update(init=True) | ||
| 1410 | + | ||
| 1403 | 1411 | @skipUnless(sys.platform == "win32", "Specifically for Windows.") | |
| 1404 | 1412 | @with_rw_directory | |
| 1405 | 1413 | def test_to_relative_path_windows_path_kinds(self, rwdir): | |
| Back | FazBrowse Home | New Git URL |
0 commit comments