max / makeover
| 1 | #!/bin/bash |
| 2 | # Canonical pre-push gate: blocks a push whose test targets do not build. |
| 3 | # |
| 4 | # DO NOT EDIT IN PLACE. The master is _private/infra/bootstrap/githooks/pre-push. |
| 5 | # |
| 6 | # Bypass for a work-in-progress push: git push --no-verify |
| 7 | # |
| 8 | # `cargo check` and `cargo clippy` both compile only the lib and bin targets, so a |
| 9 | # break confined to `tests/` or a `#[cfg(test)]` module is clean under both and |
| 10 | # lands unnoticed (goingson's sqlx 0.9 upgrade shipped exactly that way). |
| 11 | # `--no-run` builds every test target without running them, which is the cheap |
| 12 | # half of the suite and enough to catch a compile break. Tests still run |
| 13 | # separately. |
| 14 | # |
| 15 | # `--workspace` is load-bearing wherever default-members is narrower than the |
| 16 | # workspace: goingson's is src-tauri alone, so a bare `cargo test --no-run` would |
| 17 | # skip core, db-sqlite, go-mcp and got. |
| 18 | # |
| 19 | # Only installed in repos with a root Cargo.toml. MNW and synckit have none by |
| 20 | # design (standalone crates, no root workspace), so there is no one command to run |
| 21 | # and they get the pre-commit gates only. |
| 22 | |
| 23 | |
| 24 | ROOT="" |
| 25 | |
| 26 | |
| 27 | # See the canonical pre-commit: a hook run from an editor or a cron job does not |
| 28 | # get the profile's PATH, and a hook that cannot find cargo is worse than none. |
| 29 | |
| 30 | |
| 31 | [ || |
| 32 | |
| 33 | # Refs arrive on stdin as "<local ref> <local sha> <remote ref> <remote sha>". |
| 34 | # A branch deletion has an all-zero local sha and no tree to build. |
| 35 | pushing=0 |
| 36 | while ; do |
| 37 | case "" in |
| 38 | *[!0]*) pushing=1 ;; |
| 39 | esac |
| 40 | done |
| 41 | [ || |
| 42 | |
| 43 | |
| 44 | if ! ; then |
| 45 | |
| 46 | |
| 47 | |
| 48 | fi |
| 49 | |
| 50 | |
| 51 |