diff --git a/.husky/commit-msg b/.husky/commit-msg index 1d6b9eb36..fd6b3adf7 100755 --- a/.husky/commit-msg +++ b/.husky/commit-msg @@ -1,4 +1,10 @@ #!/usr/bin/env sh -. "$(dirname -- "$0")/_/husky.sh" +# `git worktree add` never runs `prepare`, so a worktree arrives with neither +# .husky/_ nor node_modules and the source below kills the commit before any +# gate can run. Run what this checkout can run, and never block on what it +# cannot: a checkout without dependencies has no gates to fail. +[ -d node_modules ] || exit 0 +_root=$(dirname -- "$0") +[ -f "$_root/_/husky.sh" ] && . "$_root/_/husky.sh" pnpm exec commitlint --edit "${1}" diff --git a/.husky/pre-commit b/.husky/pre-commit index 1b3fc18f7..78a46f621 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,5 +1,11 @@ #!/usr/bin/env sh -. "$(dirname -- "$0")/_/husky.sh" +# `git worktree add` never runs `prepare`, so a worktree arrives with neither +# .husky/_ nor node_modules and the source below kills the commit before any +# gate can run. Run what this checkout can run, and never block on what it +# cannot: a checkout without dependencies has no gates to fail. +[ -d node_modules ] || exit 0 +_root=$(dirname -- "$0") +[ -f "$_root/_/husky.sh" ] && . "$_root/_/husky.sh" pnpm run lint pnpm run build:check