FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Support SHA-256 zero OIDs in pre-push hook by dajinzhu · Pull Request #3748 · pre-commit/pre-commit · GitHub

Support SHA-256 zero OIDs in pre-push hook - #3748

Closed
dajinzhu wants to merge 1 commit into
pre-commit:mainfrom
dajinzhu:fix-pre-push-zero-oid-3664
Closed

Support SHA-256 zero OIDs in pre-push hook#3748
dajinzhu wants to merge 1 commit into
pre-commit:mainfrom
dajinzhu:fix-pre-push-zero-oid-3664

Conversation

Copy link
Copy Markdown

Fixes #3664.

The pre-push hook previously treated the all-zero object ID as a hard-coded 40-character SHA-1 value. That breaks branch creation/deletion pushes in SHA-256 repositories.

This change adds a hash-format-independent zero-OID check and covers both local and remote zero-OID cases for 40- and 64-character IDs.

Tests:

  • pytest tests/commands/hook_impl_test.py -q — 46 passed
  • pytest tests -q --ignore=tests/languages — 649 passed, 1 skipped, 3 xfailed
  • pre-commit checks passed
  • git diff --check passed

asottile closed this Aug 22, 2026
pre-commit locked as spam and limited conversation to collaborators Aug 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

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


Back | FazBrowse Home | New Git URL