Skip to content

fix(lefthook): skip site pre-push checks when nothing new is pushed - #162

Merged
taraxvoid merged 1 commit into
mainfrom
worktree-prepush-skip
Oct 13, 2026
Merged

taraxvoid merged 1 commit into
mainfrom
worktree-prepush-skip

Conversation

@taraxvoid

Copy link
Copy Markdown
Owner

The shared site pre-push hook is meant to skip test:push when 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:

  • branch deletes (local sha is all zeros, so it never equals the remote sha)
  • a new branch at a commit that's already pushed (remote sha is all zeros)
  • a tag on an already-pushed commit

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 from refs/heads/* lines with new commits, so a tag in the same push no longer overwrites it.

Tests: test/lefthook-site.test.ts now runs the hook's script from site.yml with sh against 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 ref is bumped to the release containing it (voidsite-staging's in-progress lefthook migration pins v0.13.0).

🤖 Generated with Claude Code

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>
@taraxvoid
taraxvoid merged commit 9831ac8 into main Oct 13, 2026
2 checks passed
@taraxvoid
taraxvoid deleted the worktree-prepush-skip branch October 13, 2026 05:54
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.

1 participant