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:
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user