Skip to content

Commit 9e94459

Browse files
authored
Merge pull request #2140 from gitpython-developers/dependabot/pre_commit/pre-commit-c64bca4cd5
Bump https://github.com/astral-sh/ruff-pre-commit from v0.15.8 to 0.15.12 in the pre-commit group
2 parents aee2fd5 + 714e2e1 commit 9e94459

2 files changed

Lines changed: 16 additions & 3 deletions

File tree

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ repos:
77
exclude: ^test/fixtures/
88

99
- repo: https://github.com/astral-sh/ruff-pre-commit
10-
rev: v0.15.8
10+
rev: v0.15.12
1111
hooks:
1212
- id: ruff-check
1313
args: ["--fix"]

test/test_index.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,19 @@ def _decode(stdout):
172172
_win_bash_status = WinBashStatus.check()
173173

174174

175+
def _windows_supports_symlinks():
176+
if sys.platform != "win32":
177+
return False
178+
179+
with tempfile.TemporaryDirectory(prefix="gitpython-symlink-check-") as temp_dir:
180+
link_path = osp.join(temp_dir, "link")
181+
try:
182+
os.symlink("missing-target", link_path)
183+
except (NotImplementedError, OSError):
184+
return False
185+
return S_ISLNK(os.lstat(link_path)[ST_MODE])
186+
187+
175188
def _make_hook(git_dir, name, content, make_exec=True):
176189
"""A helper to create a hook"""
177190
hp = hook_path(name, git_dir)
@@ -553,9 +566,9 @@ def _count_existing(self, repo, files):
553566
# END num existing helper
554567

555568
@pytest.mark.xfail(
556-
sys.platform == "win32" and Git().config("core.symlinks") == "true",
569+
sys.platform == "win32" and (Git().config("core.symlinks") == "true" or _windows_supports_symlinks()),
557570
reason="Assumes symlinks are not created on Windows and opens a symlink to a nonexistent target.",
558-
raises=FileNotFoundError,
571+
raises=(FileNotFoundError, GitCommandError),
559572
)
560573
@with_rw_repo("0.1.6")
561574
def test_index_mutation(self, rw_repo):

0 commit comments

Comments
 (0)