mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 08:14:42 +04:00
Merge pull request #438 from pre-commit/cygwin_check_after_setup_code
Add cygwin check after initialization. Resolves #437
This commit is contained in:
commit
747eb1fe61
2 changed files with 15 additions and 1 deletions
|
|
@ -152,8 +152,8 @@ def main(argv=None):
|
||||||
|
|
||||||
with error_handler():
|
with error_handler():
|
||||||
add_logging_handler(args.color)
|
add_logging_handler(args.color)
|
||||||
git.check_for_cygwin_mismatch()
|
|
||||||
runner = Runner.create()
|
runner = Runner.create()
|
||||||
|
git.check_for_cygwin_mismatch()
|
||||||
|
|
||||||
if args.command == 'install':
|
if args.command == 'install':
|
||||||
return install(
|
return install(
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ import mock
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from pre_commit import main
|
from pre_commit import main
|
||||||
|
from pre_commit.error_handler import PreCommitSystemExit
|
||||||
from pre_commit.util import cwd
|
from pre_commit.util import cwd
|
||||||
from testing.auto_namedtuple import auto_namedtuple
|
from testing.auto_namedtuple import auto_namedtuple
|
||||||
|
|
||||||
|
|
@ -142,3 +143,16 @@ def test_help_cmd_in_empty_directory(
|
||||||
mock.call(['help', 'run']),
|
mock.call(['help', 'run']),
|
||||||
mock.call(['run', '--help']),
|
mock.call(['run', '--help']),
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
|
def test_expected_fatal_error_no_git_repo(
|
||||||
|
tempdir_factory, cap_out, mock_out_store_directory,
|
||||||
|
):
|
||||||
|
with cwd(tempdir_factory.get()):
|
||||||
|
with pytest.raises(PreCommitSystemExit):
|
||||||
|
main.main([])
|
||||||
|
assert cap_out.get() == (
|
||||||
|
'An error has occurred: FatalError: git failed. '
|
||||||
|
'Is it installed, and are you in a Git repository directory?\n'
|
||||||
|
'Check the log at ~/.pre-commit/pre-commit.log\n'
|
||||||
|
)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue