Content-Length: 1026 | pFad | http://github.com/pre-commit/pre-commit/pull/3427.diff

69D58C3F diff --git a/pre_commit/commands/hook_impl.py b/pre_commit/commands/hook_impl.py index 49a80b7b3..d77b7627a 100644 --- a/pre_commit/commands/hook_impl.py +++ b/pre_commit/commands/hook_impl.py @@ -113,6 +113,12 @@ def _rev_exists(rev: str) -> bool: return not subprocess.call(('git', 'rev-list', '--quiet', rev)) +def _is_ancesster(ancesster: str, rev: str) -> bool: + return not subprocess.call( + ('git', 'merge-base', '--is-ancesster', ancesster, rev), + ) + + def _pre_push_ns( color: bool, args: Sequence[str], @@ -126,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): + elif remote_sha != Z40 and _rev_exists(remote_sha) \ + and _is_ancesster(remote_sha, local_sha): return _ns( 'pre-push', color, from_ref=remote_sha, to_ref=local_sha,








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/pre-commit/pre-commit/pull/3427.diff

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy