File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -49,15 +49,22 @@ def _norm_exe(exe):
4949
5050
5151def _run_legacy ():
52+ if __file__ .endswith ('.legacy' ):
53+ raise SystemExit (
54+ "bug: pre-commit's script is installed in migration mode\n "
55+ 'run `pre-commit install -f --hook-type {}` to fix this\n \n '
56+ 'Please report this bug at '
57+ 'https://github.com/pre-commit/pre-commit/issues' .format (
58+ HOOK_TYPE ,
59+ ),
60+ )
61+
5262 if HOOK_TYPE == 'pre-push' :
5363 stdin = getattr (sys .stdin , 'buffer' , sys .stdin ).read ()
5464 else :
5565 stdin = None
5666
57- legacy_script = HOOK_TYPE + '.legacy'
58- is_legacy_executed = os .path .basename (__file__ ) == legacy_script
59- legacy_hook = os .path .join (HERE , legacy_script )
60- assert not is_legacy_executed , __file__
67+ legacy_hook = os .path .join (HERE , '{}.legacy' .format (HOOK_TYPE ))
6168 if os .access (legacy_hook , os .X_OK ):
6269 cmd = _norm_exe (legacy_hook ) + (legacy_hook ,) + tuple (sys .argv [1 :])
6370 proc = subprocess .Popen (cmd , stdin = subprocess .PIPE if stdin else None )
You can’t perform that action at this time.
0 commit comments