Repository navigation
ci: add a pre-push hook that runs just ci - #21
Conversation
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
A push from a linked worktree gives the hook its GIT_DIR; tests creating scratch repositories then ran git against the worktree's own index and branch. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. WalkthroughThe pre-push hook skips CI when a push contains only deleted refs. If the Merge Risk:
|
Problem
Every repository lands through the kixel.quest merge queue (decision). Until its queue is live, a push should run the repository's checks locally. vaapi has a
cirecipe but no pre-push hook to run it. CI'sCheckjob runsnix develop --command just ci.Approach
Adds
.githooks/pre-push, the short POSIX script already landed in moq-dev/carla#4, which runsjust ciinsidenix developbecause the repository has a flake. Thecirecipe is unchanged: it already runs what CI runs, so it needs no new tools and no new dev shell.Once kixel-ai/dotfiles#396 lands, dotfiles points
core.hooksPathat a hook of its own, which runs this file as committed on the default branch (never a branch's copy), then Git LFS's pre-push, so the hook takes effect once this PR merges. It checks the working tree, not the pushed commits. It skips a push that only deletes refs, and a branch whose justfile has nocirecipe yet, saying so. It does not callgit lfs, since dotfiles' wrapper does. Unlike carla's, it also unsets the variablesgit rev-parse --local-env-varslists before running CI: a push from a linked worktree hands the hook that worktree'sGIT_DIR, and tests that create scratch repositories then rangit addandgit commitagainst the worktree's own index and branch (reproduced on kixel-ai/swole: the branch gained abasecommit andcore.bareflipped to true). The same hook already on carla, hang.live and kixel.us lacks the fix, which is a follow-up there. The hook says to delete it once this repository's queue is live.Impact
None: a hook file; no public API, wire, or CI change.
Alternatives
None; the maintainer's decisions on carla#4 apply: a working-tree hook, no dev shell added for it, and no LFS call in it.
Follow-ups
The hooks already landed on moq-dev/carla, moq-dev/hang.live and kixel-ai/kixel.us need the same
GIT_DIRfix. Once the queue is live here, delete the hook and dropcheck.yml'spull_requesttrigger, per dotfiles#396's landing order.Validation
From a plain login shell (
env -i HOME=$HOME bash -lc, withjust,nix, and the login profile's mbxcargoshim onPATH, and no shellcheck, bun, or other repository tools), the committed hook with a pushed ref on stdin rannix develop --command just ciand passed in 30 seconds, Nix and mbx caches warm. After theGIT_DIRfix, the real path,git -c core.hooksPath=.githooks push --dry-runfrom this linked worktree, passed in 8 seconds and left HEAD, the index, andcore.bareunchanged; before the fix the same command failed on swole as described above. A delete-only push and a checkout with nocirecipe each exit 0 with a message. Git LFS: no.Review
quest reviewat 861db36: Codex gpt-6.2-sol xhigh, round 2, score 10, no findings. Round 1 (score 4 or 5) raised, and round 2 settled: documentingcore.hooksPathsetup (refuted: dotfiles#396 sets it), a clean checkout per pushed ref (refuted: the working-tree hook is settled on carla#4 and kixel.us#9), and theGIT_DIRleak (fixed). A third round-1 note, Intel Mac dev shells, was refuted: the hook runs only from dotfiles' wrapper, which Intel Macs are outside of.Models
Size: S
Implementer: Claude Code, claude-sonnet-5-5, unknown
Implementer: Claude Code, claude-sonnet-5-5, unknown (iterate, XS)
🤖 Generated with Claude Code
(Written by Sonnet 5.5)