Repository navigation
fix(lefthook): skip site pre-push checks when nothing new is pushed - #162
Merged
Merged
Conversation
The skip compared each ref's local and remote sha, so branch deletes, new branches and tags at already-pushed commits all ran test:push. Count a commit as new only when no ref of the remote contains it, skip deletes, and only take the fetch-check branch from branch refs. Co-Authored-By: Claude Opus 5.5 <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.
The shared site pre-push hook is meant to skip
test:pushwhen a push carries nothing new, but it compared each ref's local sha with its remote sha. That made these all run the full suite:Now a commit counts as new only when no ref of the remote contains it (
git rev-list <sha> --not --remotes=<remote>), and deletes are skipped. A push to a URL rather than a named remote matches no remote refs, so it still runs the checks. The branch used by the "remote is ahead" fetch check now comes only fromrefs/heads/*lines with new commits, so a tag in the same push no longer overwrites it.Tests:
test/lefthook-site.test.tsnow runs the hook's script fromsite.ymlwithshagainst a temporary repo and bare remote, covering the three skip cases (which failed before this change) and two run cases. README updated.Sites pick this up when their lefthook remote
refis bumped to the release containing it (voidsite-staging's in-progress lefthook migration pins v0.13.0).🤖 Generated with Claude Code