mirror of
https://github.com/kuhyx/screen-locker.git
synced 2026-11-10 20:27:13 +01:00
Run the flutter hooks with the git hook's environment stripped
Same defect diet-guard's pre-push gate hit today, latent here: git exports GIT_DIR to its hooks, and the flutter tool shells out to git to identify its own SDK. With GIT_DIR set it reads THIS repository instead of /opt/flutter, so `flutter --version` reports our own HEAD as the framework revision and our URL as the repository, pub resolves the SDK as "0.0.0-unknown", and every dependency constraint becomes unsatisfiable. flutter also caches that answer, so the damage outlives the hook run and follows the next caller into another repo. Both flutter gates now clear the git variables at the point of use. Verified by running the analyze hook with GIT_DIR set, which failed before and passes now. Also fixes the SC2295 shellcheck finding the coverage script had been carrying -- it only surfaced now because no change had touched a shell file. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
c11e27f123
commit
bc940f1112
@ -155,7 +155,11 @@ repos:
|
||||
types: [python]
|
||||
- id: flutter-analyze
|
||||
name: flutter analyze (workout app)
|
||||
entry: bash -c 'cd stronglift_replacement/workout_app && flutter analyze'
|
||||
# env -u GIT_DIR: git exports it to hooks, and flutter shells out to
|
||||
# git to identify its own SDK -- with it set, flutter reads THIS repo
|
||||
# as the SDK and pub resolves every constraint against 0.0.0-unknown.
|
||||
entry: bash -c 'cd stronglift_replacement/workout_app &&
|
||||
env -u GIT_DIR -u GIT_WORK_TREE -u GIT_INDEX_FILE flutter analyze'
|
||||
language: system
|
||||
files: '^stronglift_replacement/workout_app/.*\.(dart|yaml)$'
|
||||
pass_filenames: false
|
||||
|
||||
@ -15,7 +15,11 @@ LCOV_INFO="$APP_DIR/coverage/lcov.info"
|
||||
cd "$APP_DIR"
|
||||
|
||||
echo "Running flutter test --coverage ..."
|
||||
flutter test --coverage
|
||||
# env -u GIT_DIR: git exports it to hooks, and the flutter tool shells out to
|
||||
# git to identify its own SDK. With it set, flutter reads THIS repository as
|
||||
# the SDK -- reporting our HEAD as the framework revision -- and pub then
|
||||
# resolves every version constraint against "0.0.0-unknown" and fails.
|
||||
env -u GIT_DIR -u GIT_WORK_TREE -u GIT_INDEX_FILE flutter test --coverage
|
||||
|
||||
cd - > /dev/null
|
||||
|
||||
@ -29,7 +33,7 @@ fi
|
||||
# Unreferenced files silently score 100% by absence — catch that here.
|
||||
missing=0
|
||||
while IFS= read -r dart_file; do
|
||||
rel="${dart_file#$APP_DIR/}"
|
||||
rel="${dart_file#"$APP_DIR"/}"
|
||||
if ! grep -qF "SF:$rel" "$LCOV_INFO" && \
|
||||
! grep -qF "SF:lib/${rel#lib/}" "$LCOV_INFO"; then
|
||||
echo "MISSING FROM COVERAGE: $dart_file" >&2
|
||||
|
||||
Loading…
Reference in New Issue
Block a user