Unset GIT_DIR and other variables before updating (#165818)

`update_engine_version.{ps1|sh}` needs to operate on a foreign
repository.
When flutter is run in a git-hook, these environment variables will
override our git calls location and corrupt the install.

fixes: #165390
This commit is contained in:
John "codefu" McDole
2025-03-24 14:45:22 -07:00
committed by GitHub
parent 844c31a683
commit 2250d3988b
3 changed files with 76 additions and 13 deletions

View File

@@ -23,6 +23,11 @@
$ErrorActionPreference = "Stop"
# When called from a submodule hook; these will override `git -C dir`
$env:GIT_DIR = $null
$env:GIT_INDEX_FILE = $null
$env:GIT_WORK_TREE = $null
$progName = Split-Path -parent $MyInvocation.MyCommand.Definition
$flutterRoot = (Get-Item $progName).parent.parent.FullName

View File

@@ -24,6 +24,11 @@
set -e
# When called from a submodule hook; these will override `git -C dir`
unset GIT_DIR
unset GIT_INDEX_FILE
unset GIT_WORK_TREE
FLUTTER_ROOT="$(dirname "$(dirname "$(dirname "${BASH_SOURCE[0]}")")")"
# Generate a bin/cache directory, which won't initially exist for a fresh checkout.