From 6c87f31a796d5b79223a9bde532db496dddab200 Mon Sep 17 00:00:00 2001 From: Talia Stocks <928827+taliastocks@users.noreply.github.com> Date: Fri, 14 Mar 2025 12:26:25 -0400 Subject: [PATCH] Apply suggestions from code review --- pre_commit/commands/hook_impl.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pre_commit/commands/hook_impl.py b/pre_commit/commands/hook_impl.py index c5d20169..ba6491b4 100644 --- a/pre_commit/commands/hook_impl.py +++ b/pre_commit/commands/hook_impl.py @@ -114,7 +114,9 @@ def _rev_exists(rev: str) -> bool: def _is_ancestor(ancestor: str, rev: str): - return not subprocess.call(('git', 'merge-base', '--is-ancestor', ancestor, rev)) + return not subprocess.call( + ('git', 'merge-base', '--is-ancestor', ancestor, rev) + ) def _pre_push_ns( @@ -130,7 +132,8 @@ def _pre_push_ns( local_branch, local_sha, remote_branch, remote_sha = parts if local_sha == Z40: continue - elif remote_sha != Z40 and _rev_exists(remote_sha) and _is_ancestor(remote_sha, local_sha): + elif remote_sha != Z40 and _rev_exists(remote_sha) \ + and _is_ancestor(remote_sha, local_sha): return _ns( 'pre-push', color, from_ref=remote_sha, to_ref=local_sha,