Repository navigation
Skip pre-push checks on delete-only pushes - #8
Merged
Merged
Conversation
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>
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.
Summary
.githooks/pre-pushunconditionally exec'dscripts/runChecks.sh, sogit 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.shis also run by hand and in CI with no stdin. Mirrors flightdirector #91.Test plans
#7
git config core.hooksPath .githooks(if not already set).git init --bare /tmp/bare.git && git remote add throwaway /tmp/bare.git.git push throwaway HEAD:refs/heads/tmp-verifyExpected: lint.sh and verifyGitLogs.sh output appears, push succeeds.
git push throwaway --delete tmp-verifyExpected: only git's own
- [deleted] tmp-verifyline, no check output.git remote remove throwaway.Closes #7
🤖 Generated with Claude Code