mirror of
https://github.com/affaan-m/everything-claude-code.git
synced 2026-03-30 13:43:26 +08:00
fix: skip pre-push checks on branch deletion
The pre-push hook runs lint/typecheck/test/build checks on every push, including `git push origin --delete <branch>`. Branch deletion does not push any code, so verification checks are unnecessary and block the delete operation. Detect deletion pushes by reading stdin (local sha is all zeros for deletes) and exit early. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -16,6 +16,20 @@ if ! git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Skip checks for branch deletion pushes (e.g., git push origin --delete <branch>).
|
||||
# The pre-push hook receives lines on stdin: <local ref> <local sha> <remote ref> <remote sha>.
|
||||
# For deletions, the local sha is the zero OID.
|
||||
is_delete_only=true
|
||||
while read -r _local_ref local_sha _remote_ref _remote_sha; do
|
||||
if [[ "$local_sha" != "0000000000000000000000000000000000000000" ]]; then
|
||||
is_delete_only=false
|
||||
break
|
||||
fi
|
||||
done
|
||||
if [[ "$is_delete_only" == "true" ]]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
ran_any_check=0
|
||||
|
||||
log() {
|
||||
|
||||
Reference in New Issue
Block a user