fix: handle SHA-256 zero OIDs in pre-push hook#3691
Closed
karlhillx wants to merge 1 commit into
Closed
Conversation
Member
|
sorry we didn't accept ai contributions |
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix SHA-256 zero OID handling in pre-push hook
In repositories initialized with
--object-format=sha256, git's pre-push hook protocol emits 64-character zero OIDs instead of the SHA-1 40-character variety. The previous hardcoded checknever matched in SHA-256 repos, causing
git push --deleteto fail with:Add
_is_zero_oid()as a hash-format-agnostic helper that accepts zero OIDs of either supported length (40 or 64), replacing the hardcodedZ40constant in_pre_push_ns.Also adds
test_run_ns_pre_push_deleting_branch_sha256as a regression test for the SHA-256 deletion push case.Fixes #3664