Skip to content

Handle SHA-256 zero OIDs in pre-push#3692

Closed
Sean-Kenneth-Doherty wants to merge 1 commit into
pre-commit:mainfrom
Sean-Kenneth-Doherty:fix/pre-push-sha256-zero-oid
Closed

Handle SHA-256 zero OIDs in pre-push#3692
Sean-Kenneth-Doherty wants to merge 1 commit into
pre-commit:mainfrom
Sean-Kenneth-Doherty:fix/pre-push-sha256-zero-oid

Conversation

@Sean-Kenneth-Doherty
Copy link
Copy Markdown

Summary

  • recognize both SHA-1 and SHA-256 all-zero object IDs in pre-push hook stdin
  • skip delete-only pushes before attempting diff/rev traversal
  • add a regression test for SHA-256 deletion pushes

Fixes #3664.

Testing

  • .venv/bin/python -m pytest -q tests/commands/hook_impl_test.py -k "pre_push_deleting_branch"
  • .venv/bin/python -m pytest -q tests/commands/hook_impl_test.py
  • .venv/bin/pre-commit run --files pre_commit/commands/hook_impl.py tests/commands/hook_impl_test.py

@asottile
Copy link
Copy Markdown
Member

sorry we don't accept ai slop contributions

@asottile asottile closed this May 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Z40 = '0' * 40 hardcoding breaks git push --delete on SHA-256 repos

2 participants