From 008779cb1e37acc4253eb42b070502a65a287bfb Mon Sep 17 00:00:00 2001 From: Jeroen Schweitzer Date: Sat, 13 Jun 2026 16:24:18 +0200 Subject: [PATCH] make post-checkout hook tolerant of fresh worktrees MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The pql post-checkout hook unconditionally sourced .pql/hooks/post-checkout from the worktree toplevel, which doesn't exist in a fresh `git worktree add` — aborting the checkout. Guard on the file existing so worktree creation (used by parallel agent workflows) no longer fails. Co-Authored-By: Claude Opus 4.8 (1M context) --- .githooks/post-checkout | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.githooks/post-checkout b/.githooks/post-checkout index b06fae2b..ae7afdc8 100755 --- a/.githooks/post-checkout +++ b/.githooks/post-checkout @@ -1,3 +1,6 @@ #!/bin/sh -# pql: source .pql/hooks/post-checkout (rebuild pql.db on branch checkout) -. "$(git rev-parse --show-toplevel)/.pql/hooks/post-checkout" +# pql: source .pql/hooks/post-checkout (rebuild pql.db on branch checkout). +# Guard on existence so a fresh `git worktree add` — whose toplevel has no +# .pql/hooks yet — doesn't abort the checkout (the hook is best-effort). +hook="$(git rev-parse --show-toplevel)/.pql/hooks/post-checkout" +[ -f "$hook" ] && . "$hook"