File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed
Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change 33Handles Git hooks directory detection and safe hook management.
44"""
55
6+ import os
67import subprocess
78from datetime import datetime
89from pathlib import Path
@@ -76,8 +77,8 @@ def backup_existing_hook(hook_path: Path) -> Path:
7677 # Copy the file content
7778 backup_path .write_text (hook_path .read_text (encoding = "utf-8" ))
7879
79- # Preserve executable permissions
80- if hook_path .stat ().st_mode & 0o111 : # Check if executable
80+ # Preserve executable permissions (Unix-like systems only)
81+ if os . name != 'nt' and hook_path .stat ().st_mode & 0o111 : # Not Windows and executable
8182 backup_path .chmod (0o755 )
8283
8384 return backup_path
Original file line number Diff line number Diff line change 22Tests for Git utility functions.
33"""
44
5+ import os
56from unittest .mock import Mock , patch
67
78import pytest
@@ -41,7 +42,10 @@ def test_backup_existing_hook(self, tmp_path):
4142 assert backup_path != hook_file
4243 assert backup_path .read_text () == hook_content
4344 assert backup_path .name .startswith ("post-merge.backup." )
44- assert backup_path .stat ().st_mode & 0o111 # Check executable bit
45+
46+ # Check executable bit only on Unix-like systems
47+ if os .name != 'nt' : # Not Windows
48+ assert backup_path .stat ().st_mode & 0o111 # Check executable bit
4549
4650 def test_merge_hook_content_new_content (self ):
4751 """Test merging when no KiLM content exists."""
You can’t perform that action at this time.
0 commit comments