Skip to content

Commit d282ac7

Browse files
committed
fix(root): clear leaked git hook env for flutter in worktrees
Git exports GIT_DIR/GIT_WORK_TREE/GIT_INDEX_FILE into hook subprocesses; in a linked worktree GIT_DIR is absolute and hijacks flutter's internal git (against its own SDK), breaking analyze/test and forcing --no-verify. Wrap the mobile flutter invocations in git:pre-commit and git:pre-push with env -u to unset those vars.
1 parent a3c488d commit d282ac7

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

mise.toml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,9 @@ fi
9292
9393
if echo "$changed" | grep -q "^apps/mobile/"; then
9494
echo "[pre-commit] apps/mobile detected, running lint..."
95-
mise //apps/mobile:lint || exit 1
95+
# Clear leaked git hook env so flutter's internal git targets its own SDK,
96+
# not this worktree (GIT_DIR is absolute in linked worktrees and hijacks it).
97+
env -u GIT_DIR -u GIT_WORK_TREE -u GIT_INDEX_FILE mise //apps/mobile:lint || exit 1
9698
fi
9799
98100
if echo "$changed" | grep -qE "Dockerfile$"; then
@@ -127,6 +129,8 @@ fi
127129
128130
if echo "$changed" | grep -q "^apps/mobile/"; then
129131
echo "[pre-push] apps/mobile detected, running test..."
130-
mise //apps/mobile:test || exit 1
132+
# Clear leaked git hook env so flutter's internal git targets its own SDK,
133+
# not this worktree (GIT_DIR is absolute in linked worktrees and hijacks it).
134+
env -u GIT_DIR -u GIT_WORK_TREE -u GIT_INDEX_FILE mise //apps/mobile:test || exit 1
131135
fi
132136
'''

0 commit comments

Comments
 (0)