diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2020-11-03 06:17:38 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2020-11-03 06:17:38 +0000 |
commit | e3829cc5d067599ba8416821f67a936b8b3dd368 (patch) | |
tree | 5b1b408e23e36868aeb04e934a51feaec86cd145 /pre_commit/main.py | |
parent | Releasing debian version 2.7.1-1. (diff) | |
download | pre-commit-e3829cc5d067599ba8416821f67a936b8b3dd368.tar.xz pre-commit-e3829cc5d067599ba8416821f67a936b8b3dd368.zip |
Merging upstream version 2.8.2.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'pre_commit/main.py')
-rw-r--r-- | pre_commit/main.py | 23 |
1 files changed, 4 insertions, 19 deletions
diff --git a/pre_commit/main.py b/pre_commit/main.py index 8647960..c1eb104 100644 --- a/pre_commit/main.py +++ b/pre_commit/main.py @@ -23,10 +23,8 @@ from pre_commit.commands.run import run from pre_commit.commands.sample_config import sample_config from pre_commit.commands.try_repo import try_repo from pre_commit.error_handler import error_handler -from pre_commit.error_handler import FatalError from pre_commit.logging_handler import logging_handler from pre_commit.store import Store -from pre_commit.util import CalledProcessError logger = logging.getLogger('pre_commit') @@ -146,21 +144,8 @@ def _adjust_args_and_chdir(args: argparse.Namespace) -> None: if args.command == 'try-repo' and os.path.exists(args.repo): args.repo = os.path.abspath(args.repo) - try: - toplevel = git.get_root() - except CalledProcessError: - raise FatalError( - 'git failed. Is it installed, and are you in a Git repository ' - 'directory?', - ) - else: - if toplevel == '': # pragma: no cover (old git) - raise FatalError( - 'git toplevel unexpectedly empty! make sure you are not ' - 'inside the `.git` directory of your repository.', - ) - else: - os.chdir(toplevel) + toplevel = git.get_root() + os.chdir(toplevel) args.config = os.path.relpath(args.config) if args.command in {'run', 'try-repo'}: @@ -339,11 +324,11 @@ def main(argv: Optional[Sequence[str]] = None) -> int: parser.parse_args(['--help']) with error_handler(), logging_handler(args.color): + git.check_for_cygwin_mismatch() + if args.command not in COMMANDS_NO_GIT: _adjust_args_and_chdir(args) - git.check_for_cygwin_mismatch() - store = Store() store.mark_config_used(args.config) |