Add pre-push validation hook
All checks were successful
libakgl CI Build / cmake_build (push) Successful in 8m44s
libakgl CI Build / performance (push) Successful in 10m6s
libakgl CI Build / memory_check (push) Successful in 13m24s
libakgl CI Build / mutation_test (push) Successful in 28m17s

This commit is contained in:
2026-08-05 18:34:08 -04:00
parent 8477ea698b
commit 3f6f3f1233
3 changed files with 111 additions and 8 deletions

View File

@@ -169,10 +169,11 @@ a line, so it rewrites runs of spaces anywhere and destroys the hand-aligned
value columns in the bit-flag tables in `actor.h` and `iterator.h`. Only leading
whitespace is ever rewritten.
### The pre-commit hook
### The Git hooks
`scripts/hooks/pre-commit` reindents staged C sources before the commit is
written. Enable it once per clone:
written, and `scripts/hooks/pre-push` runs the local build and test gates before
anything leaves the clone. Enable both once per clone:
```sh
git config core.hooksPath scripts/hooks
@@ -184,7 +185,12 @@ working tree and re-staged — but only if the index and working tree agree for
that file. If they differ, re-staging would sweep unstaged work into the commit,
so the hook stops and tells you to reindent and stage it yourself. It steps
aside during a merge, and warns rather than blocking if Emacs is unavailable.
`git commit --no-verify` bypasses it.
`git commit --no-verify` and `git push --no-verify` bypass their respective hooks.
The pre-push hook excludes performance suites, runs optional cppcheck and Doxygen
when available, and puts the slower memcheck and mutation gates behind
`AKGL_HOOK_MEMCHECK=1` and `AKGL_HOOK_MUTATION=1`. Its private build is under
`.git/akgl-prepush`; CI remains the hard gate because `core.hooksPath` is local to
each clone.
For reference, `cc-mode` defines the style as: