From 2e01c999b2466ac7e14e1e4a57a04504bd6c1b28 Mon Sep 17 00:00:00 2001 From: anthony sottile Date: Tue, 21 Jul 2026 16:26:47 -0400 Subject: [PATCH] faster check of rev existing locally as a commit --- pre_commit/commands/hook_impl.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pre_commit/commands/hook_impl.py b/pre_commit/commands/hook_impl.py index 7b806f3b8..0ec303564 100644 --- a/pre_commit/commands/hook_impl.py +++ b/pre_commit/commands/hook_impl.py @@ -114,7 +114,7 @@ def _ns( def _rev_exists(rev: str) -> bool: - return not subprocess.call(('git', 'rev-list', '--quiet', rev)) + return not subprocess.call(('git', 'cat-file', '-e', f'{rev}^{{commit}}')) def _pre_push_ns(