| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent b324c83 commit 4299c99
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -316,8 +316,9 @@ def _validated_name(cls, name: str) -> str: | |||
| 316 | 316 | ||
| 317 | 317 | @classmethod | |
| 318 | 318 | def _module_abspath(cls, parent_repo: "Repo", path: PathLike, name: str) -> PathLike: | |
| 319 | + name = cls._validated_name(name) | ||
| 319 | 320 | if cls._need_gitfile_submodules(parent_repo.git): | |
| 320 | - return osp.join(parent_repo.git_dir, "modules", cls._validated_name(name)) | ||
| 321 | + return osp.join(parent_repo.git_dir, "modules", name) | ||
| 321 | 322 | if parent_repo.working_tree_dir: | |
| 322 | 323 | return osp.join(parent_repo.working_tree_dir, path) | |
| 323 | 324 | raise NotADirectoryError() | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -971,6 +971,10 @@ def test_update_rejects_parent_component_in_name(self, rwdir): | |||
| 971 | 971 | with pytest.raises(ValueError, match="submodule name"): | |
| 972 | 972 | Submodule._module_abspath(clone, "module", name) | |
| 973 | 973 | ||
| 974 | + with mock.patch.object(Submodule, "_need_gitfile_submodules", return_value=False): | ||
| 975 | + with pytest.raises(ValueError, match="submodule name"): | ||
| 976 | + Submodule._module_abspath(clone, "module", "../module") | ||
| 977 | + | ||
| 974 | 978 | @with_rw_directory | |
| 975 | 979 | @_patch_git_config("protocol.file.allow", "always") | |
| 976 | 980 | def test_root_update_keeps_going_after_invalid_submodule_name(self, rwdir): | |
| Back | FazBrowse Home | New Git URL |
0 commit comments