| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -324,9 +324,9 @@ def _is_path_rooted(path: PathLike) -> bool: | |||
| 324 | 324 | On POSIX, which has no drive concept, this simply distinguishes absolute | |
| 325 | 325 | paths such as ``/directory`` from relative paths such as ``directory``. | |
| 326 | 326 | """ | |
| 327 | - _drive, tail = osp.splitdrive(os.fspath(path)) | ||
| 327 | + drive, tail = osp.splitdrive(os.fspath(path)) | ||
| 328 | 328 | separators = (os.sep,) if os.altsep is None else (os.sep, os.altsep) | |
| 329 | - return tail.startswith(separators) | ||
| 329 | + return tail.startswith(separators) or bool(drive) and osp.isabs(path) | ||
| 330 | 330 | ||
| 331 | 331 | ||
| 332 | 332 | def _to_relative_path(root: PathLike, path: PathLike) -> str: | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1090,6 +1090,15 @@ class Mocked: | |||
| 1090 | 1090 | actual_path = index._to_relative_path(path) | |
| 1091 | 1091 | self.assertEqual(expected_path, actual_path) | |
| 1092 | 1092 | ||
| 1093 | + @pytest.mark.skipif(sys.platform != "win32", reason="Specifically for Windows.") | ||
| 1094 | + def test__to_relative_path_windows_unc_share_root(self): | ||
| 1095 | + for repo_root in [R"\\server\share", R"\\?\UNC\server\share"]: | ||
| 1096 | + with self.subTest(repo_root=repo_root): | ||
| 1097 | + repo = mock.Mock(bare=False, git_dir=repo_root, working_tree_dir=repo_root) | ||
| 1098 | + index = IndexFile(repo) | ||
| 1099 | + | ||
| 1100 | + self.assertEqual(index._to_relative_path(repo_root), ".") | ||
| 1101 | + | ||
| 1093 | 1102 | @pytest.mark.skipif(sys.platform != "win32", reason="Specifically for Windows.") | |
| 1094 | 1103 | @with_rw_directory | |
| 1095 | 1104 | def test__to_relative_path_windows_path_kinds(self, rw_dir): | |
| Back | FazBrowse Home | New Git URL |
0 commit comments