From 88ccb3e75dc9937dda79bd8e81d368fc23b8bda8 Mon Sep 17 00:00:00 2001 From: Dan Yeaw Date: Sat, 19 Sep 2020 22:16:19 -0400 Subject: [PATCH] Remove cygwin git mismatch message in MSYS2 --- pre_commit/git.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pre_commit/git.py b/pre_commit/git.py index 576bef8c..76abb6fe 100644 --- a/pre_commit/git.py +++ b/pre_commit/git.py @@ -182,7 +182,9 @@ def check_for_cygwin_mismatch() -> None: if sys.platform in ('cygwin', 'win32'): # pragma: no cover (windows) is_cygwin_python = sys.platform == 'cygwin' toplevel = cmd_output('git', 'rev-parse', '--show-toplevel')[1] - is_cygwin_git = toplevel.startswith('/') + git_exec_path = cmd_output('git', '--exec-path')[1].strip() + is_msys2_git = git_exec_path == '/usr/lib/git-core' + is_cygwin_git = toplevel.startswith('/') and not is_msys2_git if is_cygwin_python ^ is_cygwin_git: exe_type = {True: '(cygwin)', False: '(windows)'}