From 0c166e14da278428da93868508869f7f3c8c4242 Mon Sep 17 00:00:00 2001 From: ohashi-mizuki Date: Sun, 29 Mar 2026 23:09:26 +0900 Subject: [PATCH] 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 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) --- scripts/codex-git-hooks/pre-push | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/scripts/codex-git-hooks/pre-push b/scripts/codex-git-hooks/pre-push index 2182cbf4..82a6b026 100644 --- a/scripts/codex-git-hooks/pre-push +++ b/scripts/codex-git-hooks/pre-push @@ -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 ). +# The pre-push hook receives lines on stdin: . +# 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() {