saw hook¶
Scan on clone, and before you push. saw's git hooks scan what lands in a repository (a clone
and its submodules, a pull, a branch switch, a rebase, a file checkout) and warn you before a dependency install, a build or an editor
task runs it. A git push is checked for everything it would publish before the code leaves your
machine. The hooks warn and point at saw fix; they never change your code, never break a
git command, and never stop a push. See scan on clone.
saw hook install [PATH...] [-c FILE] [--no-stream]
saw hook repair [--no-stream]
saw hook uninstall [--no-stream]
saw hook status [--no-stream]
| Option / subcommand | Description |
|---|---|
install |
Give the hooks to every repository you clone or create from now on, and to the repositories you already have. |
PATH... |
Repositories, folders or globs to give the hooks to. Without them: your configured local targets, else the repository you are in. |
repair |
Put back every hook saw installed, and set aside whatever stood in its place. |
uninstall |
Remove saw's hooks, from new clones and from the repositories you gave them to or they have run in, and restore any hook of yours they ran before. |
status |
Whether the hooks are in place and will run. |
-c, --config FILE |
Your config, whose allowlist the hooks scan with. A repository's own config is never read. |
--no-stream |
Plain instant lines instead of live progress. Same as STAYAWAKE_NO_STREAM=1. |
What to expect¶
- Your repositories stay current. Whenever one of saw's hooks runs, a saw hook that is missing or out of date there is put back. Your own hooks keep running and are left as they are.
- Nothing is deleted. Whatever saw sets aside is kept, with a record of where it came from, for you to examine. What could not be put back is said, with the command to run.
saw auditreports a hook saw did not install, or one of saw's that was changed;saw hook repairputs it back.- Scans are quick and bounded, and agree with
saw scan. A pull, a switch, a rebase, an amend or a file checkout scans what changed, and what it says about the project as a whole is whatsaw scansays. Each scan has a time budget (SAW_HOOK_TIMEOUT: 60s, 20s for a push). What could not be checked in time reads as not verified, never clean. - A push goes through. A worm it would publish is named with the commit that carries it and
pointed at
saw fix amend. Your own pre-push hook and Git LFS keep their say. git reset --hardruns no hook; check that case withsaw scan.