Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ repos:
exclude: ^test/fixtures/

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.15.8
rev: v0.15.12
hooks:
- id: ruff-check
args: ["--fix"]
Expand Down
17 changes: 15 additions & 2 deletions test/test_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,19 @@ def _decode(stdout):
_win_bash_status = WinBashStatus.check()


def _windows_supports_symlinks():
if sys.platform != "win32":
return False

with tempfile.TemporaryDirectory(prefix="gitpython-symlink-check-") as temp_dir:
link_path = osp.join(temp_dir, "link")
try:
os.symlink("missing-target", link_path)
except (NotImplementedError, OSError):
return False
return S_ISLNK(os.lstat(link_path)[ST_MODE])


def _make_hook(git_dir, name, content, make_exec=True):
"""A helper to create a hook"""
hp = hook_path(name, git_dir)
Expand Down Expand Up @@ -553,9 +566,9 @@ def _count_existing(self, repo, files):
# END num existing helper

@pytest.mark.xfail(
sys.platform == "win32" and Git().config("core.symlinks") == "true",
sys.platform == "win32" and (Git().config("core.symlinks") == "true" or _windows_supports_symlinks()),
reason="Assumes symlinks are not created on Windows and opens a symlink to a nonexistent target.",
raises=FileNotFoundError,
raises=(FileNotFoundError, GitCommandError),
)
@with_rw_repo("0.1.6")
def test_index_mutation(self, rw_repo):
Expand Down
Loading