Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8cfe8e5

Browse files
committed
don't crash on cygwin mismatch check
1 parent 6c62945 commit 8cfe8e5

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

pre_commit/git.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,10 @@ def check_for_cygwin_mismatch() -> None:
201201
"""See https://github.com/pre-commit/pre-commit/issues/354"""
202202
if sys.platform in ('cygwin', 'win32'): # pragma: no cover (windows)
203203
is_cygwin_python = sys.platform == 'cygwin'
204-
toplevel = get_root()
204+
try:
205+
toplevel = get_root()
206+
except FatalError: # skip the check if we're not in a git repo
207+
return
205208
is_cygwin_git = toplevel.startswith('/')
206209

207210
if is_cygwin_python ^ is_cygwin_git:

0 commit comments

Comments
 (0)