From b285cccb19e00d213cc3147e805084a97b6f4c6b Mon Sep 17 00:00:00 2001 From: Paul Tarjan Date: Fri, 26 Dec 2025 14:57:28 -0700 Subject: [PATCH] use git cat-file -e instead of git rev-list in _rev_exists fixes #3604 --- 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 de5c8f34..ddfac519 100644 --- a/pre_commit/commands/hook_impl.py +++ b/pre_commit/commands/hook_impl.py @@ -111,7 +111,7 @@ def _ns( def _rev_exists(rev: str) -> bool: - return not subprocess.call(('git', 'rev-list', '--quiet', rev)) + return subprocess.call(('git', 'cat-file', '-e', rev)) == 0 def _pre_push_ns(