| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
set -euo pipefail |
| 18 |
|
| 19 |
ROOT="$(git rev-parse --show-toplevel)" |
| 20 |
cd "$ROOT" |
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
pushing=0 |
| 25 |
while read -r _local_ref local_sha _remote_ref _remote_sha; do |
| 26 |
case "$local_sha" in |
| 27 |
*[!0]*) pushing=1 ;; |
| 28 |
esac |
| 29 |
done |
| 30 |
[ "$pushing" -eq 1 ] || exit 0 |
| 31 |
|
| 32 |
echo "pre-push: building test targets (cargo test --no-run --workspace)..." |
| 33 |
if ! cargo test --no-run --workspace; then |
| 34 |
echo "pre-push: test targets failed to build." |
| 35 |
echo "pre-push: push aborted (use --no-verify to bypass)." |
| 36 |
exit 1 |
| 37 |
fi |
| 38 |
|
| 39 |
echo "pre-push: test targets build clean." |
| 40 |
|