Fix double legacy install on windows

This commit is contained in:
Anthony Sottile 2019-04-27 15:10:01 -07:00
parent b8300268bf
commit af2c6de9ae
2 changed files with 12 additions and 1 deletions

View file

@ -5,6 +5,7 @@ import io
import itertools
import logging
import os.path
import shutil
import sys
from pre_commit import git
@ -84,7 +85,7 @@ def install(
# If we have an existing hook, move it to pre-commit.legacy
if os.path.lexists(hook_path) and not is_our_script(hook_path):
os.rename(hook_path, legacy_path)
shutil.move(hook_path, legacy_path)
# If we specify overwrite, we simply delete the legacy file
if overwrite and os.path.exists(legacy_path):