summaryrefslogtreecommitdiffstats
path: root/pre_commit/commands
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--pre_commit/commands/run.py12
-rw-r--r--pre_commit/commands/sample_config.py4
2 files changed, 8 insertions, 8 deletions
diff --git a/pre_commit/commands/run.py b/pre_commit/commands/run.py
index ad3d766..429e04c 100644
--- a/pre_commit/commands/run.py
+++ b/pre_commit/commands/run.py
@@ -263,7 +263,7 @@ def _all_filenames(args: argparse.Namespace) -> Collection[str]:
def _get_diff() -> bytes:
_, out, _ = cmd_output_b(
- 'git', 'diff', '--no-ext-diff', '--ignore-submodules', retcode=None,
+ 'git', 'diff', '--no-ext-diff', '--ignore-submodules', check=False,
)
return out
@@ -318,7 +318,7 @@ def _has_unmerged_paths() -> bool:
def _has_unstaged_config(config_file: str) -> bool:
retcode, _, _ = cmd_output_b(
'git', 'diff', '--no-ext-diff', '--exit-code', config_file,
- retcode=None,
+ check=False,
)
# be explicit, other git errors don't mean it has an unstaged config.
return retcode == 1
@@ -333,7 +333,7 @@ def run(
stash = not args.all_files and not args.files
# Check if we have unresolved merge conflict files and fail fast.
- if _has_unmerged_paths():
+ if stash and _has_unmerged_paths():
logger.error('Unmerged files. Resolve before committing.')
return 1
if bool(args.from_ref) != bool(args.to_ref):
@@ -420,7 +420,11 @@ def run(
return 1
skips = _get_skips(environ)
- to_install = [hook for hook in hooks if hook.id not in skips]
+ to_install = [
+ hook
+ for hook in hooks
+ if hook.id not in skips and hook.alias not in skips
+ ]
install_hook_envs(to_install, store)
return _run_hooks(config, hooks, skips, args)
diff --git a/pre_commit/commands/sample_config.py b/pre_commit/commands/sample_config.py
index 82a1617..ce22f65 100644
--- a/pre_commit/commands/sample_config.py
+++ b/pre_commit/commands/sample_config.py
@@ -1,7 +1,3 @@
-# TODO: maybe `git ls-remote git://github.com/pre-commit/pre-commit-hooks` to
-# determine the latest revision? This adds ~200ms from my tests (and is
-# significantly faster than https:// or http://). For now, periodically
-# manually updating the revision is fine.
from __future__ import annotations
SAMPLE_CONFIG = '''\
# See https://pre-commit.com for more information