Skip to content

Handle SHA-256 zero OIDs in pre-push hooks#3693

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 hooks#3693
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 input
  • Keep branch deletion handling from asking Git to inspect a SHA-256 zero OID
  • Add a regression test for SHA-256 branch deletion input

Validation

  • .venv/bin/python -m pytest -q tests/commands/hook_impl_test.py::test_run_ns_pre_push_deleting_branch_sha256 tests/commands/hook_impl_test.py::test_run_ns_pre_push_deleting_branch
  • .venv/bin/python -m pytest -q tests/commands/hook_impl_test.py
  • .venv/bin/python -m pre_commit run --files pre_commit/commands/hook_impl.py tests/commands/hook_impl_test.py
  • .venv/bin/python -m compileall -q pre_commit/commands/hook_impl.py tests/commands/hook_impl_test.py
  • git diff --check origin/main...HEAD

@asottile

Copy link
Copy Markdown
Member

sorry we don't accept ai slop

@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.

2 participants