diff --git a/scripts/git-hooks/post-checkout.mjs b/scripts/git-hooks/post-checkout.mjs index 0f8d21a1..b927b182 100644 --- a/scripts/git-hooks/post-checkout.mjs +++ b/scripts/git-hooks/post-checkout.mjs @@ -17,7 +17,10 @@ import { fileURLToPath } from "url"; const __dirname = path.dirname(fileURLToPath(import.meta.url)); -const isBranchCheckout = process.argv[4] === "1"; +// Git supplies three arguments when invoking this as a post-checkout hook. When run directly, +// assume the caller wants to configure the current worktree instead of requiring placeholder refs. +const isManualRun = process.argv.length === 2; +const isBranchCheckout = isManualRun || process.argv[4] === "1"; if (!isBranchCheckout) { process.exit(0);