scripts/run-lefthook now searches the hoisted node_modules layouts the generated hook
searches (npm, pnpm --node-linker=hoisted), in this tree and the clone's main checkout,
and only execs lefthook. The jobs call `{just}` (scripts/hook-just), which falls back to
scripts/run-in-hermes-env only once lefthook has matched staged files to the job, so a
commit no job matches never runs, or fails on, environment setup.
Tests: hoisted lookup, main-checkout lookup from a linked worktree, the no-`just` job
path, and a real docs-only commit without `just` that never reaches setup.
10 lines
466 B
Bash
Executable File
10 lines
466 B
Bash
Executable File
#!/bin/sh
|
|
# `just` for a git-hook job (`{just}` in lefthook.yml), resolved only once lefthook has
|
|
# matched staged files to the job: a commit no job matches never sets up an environment.
|
|
# An unactivated shell has no `just`, a PM tool: it comes from this checkout's own
|
|
# environment (scripts/run-in-hermes-env), never from a venv on PATH or `uv run`.
|
|
if command -v just >/dev/null 2>&1; then
|
|
exec just "$@"
|
|
fi
|
|
exec "$(dirname "$0")/run-in-hermes-env" just "$@"
|