From c5a8315166571fa264847d6bfe31cc285f5784b7 Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Sat, 28 Nov 2026 09:37:54 -0800 Subject: [PATCH 1/2] ci: add a pre-push hook that runs just ci Co-Authored-By: Claude Sonnet 5.5 --- .githooks/pre-push | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100755 .githooks/pre-push diff --git a/.githooks/pre-push b/.githooks/pre-push new file mode 100755 index 0000000..f1bc738 --- /dev/null +++ b/.githooks/pre-push @@ -0,0 +1,19 @@ +#!/bin/sh +# Run the repository's CI before every push, so a failure surfaces here instead of in the merge queue. +# Delete this hook once this repository's kixel.quest merge queue is live. +set -e +# A push that only deletes refs carries no commits to check. +pushes=false +while read -r _ sha _ _; do + case $sha in *[!0]*) pushes=true ;; esac +done +$pushes || exit 0 +# A branch from before the recipe, which pull request CI still checks, has none to run. +if ! grep -Eq '^ci([[:space:]]|:)' justfile 2>/dev/null; then + echo "pre-push: this checkout has no just ci recipe; merge the default branch to check pushes here" >&2 + exit 0 +fi +if [ -f flake.nix ]; then + exec nix develop --command just ci +fi +exec just ci From 861db3620f4f929940e7ad9f03345deb51f6ca01 Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Sat, 28 Nov 2026 09:45:08 -0800 Subject: [PATCH 2/2] ci: clear git's repository environment before the hook runs just ci 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 --- .githooks/pre-push | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.githooks/pre-push b/.githooks/pre-push index f1bc738..a585bf6 100755 --- a/.githooks/pre-push +++ b/.githooks/pre-push @@ -13,6 +13,8 @@ if ! grep -Eq '^ci([[:space:]]|:)' justfile 2>/dev/null; then echo "pre-push: this checkout has no just ci recipe; merge the default branch to check pushes here" >&2 exit 0 fi +# A linked worktree's push hands the hook its GIT_DIR, which would send a test's scratch repository's git commands to this one. +for var in $(git rev-parse --local-env-vars); do unset "$var"; done if [ -f flake.nix ]; then exec nix develop --command just ci fi