Skip to content

Skip pre-push checks on delete-only pushes - #8

Merged
DaveWoodCom merged 1 commit into
mainfrom
feature/7-pre-push-skip-deletes
Sep 6, 2026
Merged

DaveWoodCom merged 1 commit into
mainfrom
feature/7-pre-push-skip-deletes

Conversation

@DaveWoodCom

Copy link
Copy Markdown
Contributor

Summary

.githooks/pre-push unconditionally exec'd scripts/runChecks.sh, so git push origin --delete <branch> printed the full lint and commit-signature output even though no commits were pushed. The hook now reads git's per-ref stdin lines (<local ref> <local sha> <remote ref> <remote sha>) and exits 0 before running the checks when every local sha is all-zero, i.e. a delete-only push or an empty ref list. Any push carrying commits still runs the checks, and the runner's exit code still propagates.

The change lives in the hook rather than a check script because only the hook receives git's stdin; runChecks.sh is also run by hand and in CI with no stdin. Mirrors flightdirector #91.

Test plans

#7

  1. git config core.hooksPath .githooks (if not already set).
  2. Create a throwaway bare remote: git init --bare /tmp/bare.git && git remote add throwaway /tmp/bare.git.
  3. git push throwaway HEAD:refs/heads/tmp-verify
    Expected: lint.sh and verifyGitLogs.sh output appears, push succeeds.
  4. git push throwaway --delete tmp-verify
    Expected: only git's own - [deleted] tmp-verify line, no check output.
  5. git remote remove throwaway.

Closes #7

🤖 Generated with Claude Code

git feeds the pre-push hook one "<local ref> <local sha> <remote ref>
<remote sha>" line per ref on stdin; a branch deletion has an all-zero
local sha. Read those lines and exit 0 before running scripts/runChecks.sh
when every ref is a delete (or nothing is being pushed), so
`git push origin --delete <branch>` no longer prints the full lint and
signature output. Any push carrying commits still runs the checks.

Mirrors flightdirector #91. Closes #7.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@DaveWoodCom
DaveWoodCom merged commit bfb96b8 into main Sep 6, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pre-push hook runs lint + signature checks on branch deletions — read the ref pairs on stdin and skip when nothing is pushed

1 participant