Repository navigation
Commit 63a9bd7
authored
fix(eql): make the pre-commit drift gate run in the monorepo
The hook never ran in cipherstash/stack, and would have matched nothing if
it had:
- `mise run install-hooks` set core.hooksPath to `tasks/githooks`. Git
resolves a relative hooksPath against the root of the working tree, which
here is the monorepo root, so git looked for `tasks/githooks` there and
ran no hook. It now writes the path from the root, through
`git rev-parse --show-prefix`.
- Git runs a hook from the root of the working tree, so the staged paths
carried a `packages/eql/` prefix that the hook's patterns, anchored at
`crates/` and `src/`, never matched. The hook now lists only the staged
paths under this package, relative to it.
- `mise run` ran from the monorepo root, where this package's tasks are not
defined. The hook now works from the package root.
The prefix is computed from paths rather than with `cd` and
`git diff --relative`, because git exports GIT_DIR to a hook, and with
GIT_DIR set git takes the current directory as the top of the working tree.
Checked with `git hook run pre-commit` from the monorepo root: a staged
`src/v3/schema.sql` runs `test:schemas:parity`, and an unrelated staged file
runs nothing. Running the hook from the package directory still works.
Claude-Session: https://claude.ai/code/session_01VYKAWbd361xDLmqBdLoUcB1 parent d21ef3f commit 63a9bd7
2 files changed
Lines changed: 21 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
235 | 235 | | |
236 | 236 | | |
237 | 237 | | |
238 | | - | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
239 | 241 | | |
240 | 242 | | |
241 | 243 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
17 | 34 | | |
18 | 35 | | |
19 | 36 | | |
| |||
0 commit comments