| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 1d47514 commit c96bbe3
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -414,6 +414,11 @@ def _to_relative_path(cls, parent_repo: "Repo", path: PathLike) -> PathLike: | |||
| 414 | 414 | ||
| 415 | 415 | return path | |
| 416 | 416 | ||
| 417 | + @property | ||
| 418 | + def abspath(self) -> PathLike: | ||
| 419 | + self._to_relative_path(self.repo, self.path) | ||
| 420 | + return super().abspath | ||
| 421 | + | ||
| 417 | 422 | @classmethod | |
| 418 | 423 | def _write_git_file_and_module_config(cls, working_tree_dir: PathLike, module_abspath: PathLike) -> None: | |
| 419 | 424 | """Write a ``.git`` file containing a (preferably) relative path to the actual | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1369,6 +1369,21 @@ class Repo: | |||
| 1369 | 1369 | osp.join(Repo.working_tree_dir + "-other", "module"), | |
| 1370 | 1370 | ) | |
| 1371 | 1371 | ||
| 1372 | + @with_rw_directory | ||
| 1373 | + def test_update_rejects_checkout_path_outside_parent(self, rwdir): | ||
| 1374 | + parent = git.Repo.init(osp.join(rwdir, "parent")) | ||
| 1375 | + submodule = Submodule( | ||
| 1376 | + parent, | ||
| 1377 | + Submodule.NULL_BIN_SHA, | ||
| 1378 | + name="module", | ||
| 1379 | + path=osp.join("..", "outside"), | ||
| 1380 | + url="unused", | ||
| 1381 | + ) | ||
| 1382 | + | ||
| 1383 | + with mock.patch.object(Submodule, "_clone_repo", side_effect=AssertionError("clone attempted")): | ||
| 1384 | + with pytest.raises(ValueError, match="is not in repository"): | ||
| 1385 | + submodule.update(init=True) | ||
| 1386 | + | ||
| 1372 | 1387 | @skipUnless(sys.platform == "win32", "Specifically for Windows.") | |
| 1373 | 1388 | @with_rw_directory | |
| 1374 | 1389 | def test_to_relative_path_windows_path_kinds(self, rwdir): | |
| Back | FazBrowse Home | New Git URL |
0 commit comments