handle missing follow_symlinks on windows

This commit is contained in:
Kovid Goyal 2025-09-21 06:06:17 +05:30
parent 74662373cb
commit cf725bee8c
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -104,7 +104,10 @@ class GitHooks(Command):
os.remove(path) # remove if symlink
with open(path, 'wb') as f:
f.write(script.encode('utf-8'))
os.chmod(path, 0o744, follow_symlinks=False)
try:
os.chmod(path, 0o744, follow_symlinks=False)
except TypeError:
os.chmod(path, 0o744)
def uninstall(self):
self.info('Uninstalling the hooks:', ', '.join(self.names))