make post-checkout hook tolerant of fresh worktrees

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) <noreply@anthropic.com>
This commit is contained in:
2026-06-13 16:24:18 +02:00
co-authored by Claude Opus 4.8
parent 25db19fc0e
commit 008779cb1e
+5 -2
View File
@@ -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"