Skip to content

Handle SHA-256 zero OID in pre-push - #3751

Closed
Dmao233 wants to merge 1 commit into
pre-commit:mainfrom
Dmao233:cursor/sha256-zero-oid-pre-push-c5cf
Closed

Dmao233 wants to merge 1 commit into
pre-commit:mainfrom
Dmao233:cursor/sha256-zero-oid-pre-push-c5cf

Conversation

@Dmao233

@Dmao233 Dmao233 commented Aug 31, 2026

Copy link
Copy Markdown

Fixes #3664

pre-push only treated 0*40 as the zero oid. SHA-256 repos send 64 zeros, so git push --delete fell through to git diff and died on an invalid revision range.

Treat both 40-zero and 64-zero oids as the zero sha. Tests cover both lengths.

git's pre-push protocol emits 64-zero oids on sha256 repos.
the hardcoded Z40 check missed deletions so `git push --delete`
failed with an invalid revision range.

Fixes pre-commit#3664

Co-authored-by: CenFangyu <Dmao233@users.noreply.github.com>
@asottile asottile closed this Aug 31, 2026
@pre-commit pre-commit locked as spam and limited conversation to collaborators Aug 31, 2026
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

3 participants