20 lines
1.1 KiB
Text
20 lines
1.1 KiB
Text
|
|
#!/usr/bin/env bash
|
||
|
|
# The pre-push hook: commits going to main must be signed as deploying it requires
|
||
|
|
# (tool/check_signatures.sh, a moment), then the checks CI runs (tool/check.dart,
|
||
|
|
# minutes). A push only goes through when both pass.
|
||
|
|
#
|
||
|
|
# Install it in a fresh clone: ln -s ../../tool/pre-push .git/hooks/pre-push
|
||
|
|
# Skip it for one push: git push --no-verify
|
||
|
|
set -euo pipefail
|
||
|
|
cd "$(git rev-parse --show-toplevel)"
|
||
|
|
|
||
|
|
# As a hook in a worktree, git hands this its GIT_DIR, an absolute path to the worktree's
|
||
|
|
# folder in the main repository. pub runs git with -C on its git dependencies' caches, which
|
||
|
|
# GIT_DIR overrides, so it judged the workspace's resolution stale, resolved it with dart
|
||
|
|
# alone and failed ("halkyon_learn_flutter requires the Flutter SDK"; 2026-10-16). Nothing
|
||
|
|
# below needs them: git finds the repository from the folder it runs in.
|
||
|
|
unset GIT_DIR GIT_WORK_TREE GIT_INDEX_FILE GIT_COMMON_DIR GIT_OBJECT_DIRECTORY GIT_PREFIX
|
||
|
|
|
||
|
|
# git's arguments (the remote) and stdin (the refs pushed) go to the signature check.
|
||
|
|
tool/check_signatures.sh "$@"
|
||
|
|
exec dart run tool/check.dart
|