fix(tool): the checks run as a hook from a worktree too
All checks were successful
CI / check (push) Successful in 20m15s
CI / deploy (push) Has been skipped

Pushing from a worktree failed before any test ran: "Because
halkyon_learn_flutter requires the Flutter SDK, version solving
failed." Git hands a hook in a worktree an absolute GIT_DIR, which
overrides the -C that pub runs git with on its git dependencies, so pub
judged the workspace's resolution stale and resolved it with dart alone.
The checks now clear git's variables first; git finds the repository
from the folder it runs in.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
Tizian 「ティツィアーン」 2026-10-16 22:41:58 +02:00
commit 496c844989
Signed by: raisondetredev
GPG key ID: 07F6FCF405488B64

View file

@ -10,6 +10,13 @@
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
# As the pre-push hook, first: commits going to main must be signed as deploying it requires
# (tool/check_signatures.sh), which takes a moment, where the rest takes minutes.
if [ "$(basename "$0")" = pre-push ]; then