| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent c96bbe3 commit bf61b38
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -416,8 +416,11 @@ def _to_relative_path(cls, parent_repo: "Repo", path: PathLike) -> PathLike: | |||
| 416 | 416 | ||
| 417 | 417 | @property | |
| 418 | 418 | def abspath(self) -> PathLike: | |
| 419 | - self._to_relative_path(self.repo, self.path) | ||
| 420 | - return super().abspath | ||
| 419 | + path = super().abspath | ||
| 420 | + root = self.repo.working_tree_dir | ||
| 421 | + assert root is not None | ||
| 422 | + _to_relative_path(osp.realpath(root), osp.realpath(path)) | ||
| 423 | + return path | ||
| 421 | 424 | ||
| 422 | 425 | @classmethod | |
| 423 | 426 | def _write_git_file_and_module_config(cls, working_tree_dir: PathLike, module_abspath: PathLike) -> None: | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1384,6 +1384,22 @@ def test_update_rejects_checkout_path_outside_parent(self, rwdir): | |||
| 1384 | 1384 | with pytest.raises(ValueError, match="is not in repository"): | |
| 1385 | 1385 | submodule.update(init=True) | |
| 1386 | 1386 | ||
| 1387 | + @with_rw_directory | ||
| 1388 | + def test_update_rejects_checkout_path_through_outside_symlink(self, rwdir): | ||
| 1389 | + parent = git.Repo.init(osp.join(rwdir, "parent")) | ||
| 1390 | + os.symlink(osp.join(rwdir, "outside"), osp.join(parent.working_tree_dir, "link")) | ||
| 1391 | + submodule = Submodule( | ||
| 1392 | + parent, | ||
| 1393 | + Submodule.NULL_BIN_SHA, | ||
| 1394 | + name="module", | ||
| 1395 | + path=osp.join("link", "module"), | ||
| 1396 | + url="unused", | ||
| 1397 | + ) | ||
| 1398 | + | ||
| 1399 | + with mock.patch.object(Submodule, "_clone_repo", side_effect=AssertionError("clone attempted")): | ||
| 1400 | + with pytest.raises(ValueError, match="is not in repository"): | ||
| 1401 | + submodule.update(init=True) | ||
| 1402 | + | ||
| 1387 | 1403 | @skipUnless(sys.platform == "win32", "Specifically for Windows.") | |
| 1388 | 1404 | @with_rw_directory | |
| 1389 | 1405 | def test_to_relative_path_windows_path_kinds(self, rwdir): | |
| Back | FazBrowse Home | New Git URL |
0 commit comments