|
40 | 40 | from git.util import Actor, cwd, hex_to_bin, rmtree |
41 | 41 |
|
42 | 42 | from test.lib import TestBase, VirtualEnvironment, fixture, fixture_path, with_rw_directory, with_rw_repo, PathLikeMock |
43 | | -from test.lib.helper import xfail_if_raises |
| 43 | +from test.lib.helper import symlinks_supported, xfail_if_raises |
44 | 44 |
|
45 | 45 | HOOKS_SHEBANG = "#!/usr/bin/env sh\n" |
46 | 46 |
|
@@ -175,19 +175,6 @@ def _decode(stdout): |
175 | 175 | _win_bash_status = WinBashStatus.check() |
176 | 176 |
|
177 | 177 |
|
178 | | -def _windows_supports_symlinks(): |
179 | | - if sys.platform != "win32": |
180 | | - return False |
181 | | - |
182 | | - with tempfile.TemporaryDirectory(prefix="gitpython-symlink-check-") as temp_dir: |
183 | | - link_path = osp.join(temp_dir, "link") |
184 | | - try: |
185 | | - os.symlink("missing-target", link_path) |
186 | | - except (NotImplementedError, OSError): |
187 | | - return False |
188 | | - return S_ISLNK(os.lstat(link_path)[ST_MODE]) |
189 | | - |
190 | | - |
191 | 178 | def _make_hook(git_dir, name, content, make_exec=True): |
192 | 179 | """A helper to create a hook""" |
193 | 180 | hp = hook_path(name, git_dir) |
@@ -655,7 +642,7 @@ def _count_existing(self, repo, files): |
655 | 642 | @with_rw_repo("0.1.6") |
656 | 643 | def test_index_mutation(self, rw_repo): |
657 | 644 | with xfail_if_raises( |
658 | | - sys.platform == "win32" and (Git().config("core.symlinks") == "true" or _windows_supports_symlinks()), |
| 645 | + sys.platform == "win32" and (Git().config("core.symlinks") == "true" or symlinks_supported()), |
659 | 646 | raises=(FileNotFoundError, GitCommandError), |
660 | 647 | reason="Assumes symlinks are not created on Windows and opens a symlink to a nonexistent target.", |
661 | 648 | ): |
|
0 commit comments