fix(shorebird_cli): print shorebird checkout output on windows, verify longpaths (#2710)
This commit is contained in:
+17
-8
@@ -23,12 +23,12 @@ $dart = [IO.Path]::Combine($flutterPath, "bin", "cache", "dart-sdk", "bin", "dar
|
||||
# This is fixed in Powershell 7.1.
|
||||
#
|
||||
# See https://github.com/PowerShell/PowerShell/issues/4002 for more info.
|
||||
function Invoke-SilentlyIfPossible($command) {
|
||||
function Invoke-SilentlyIfNeeded($command) {
|
||||
$psVersion = $PSVersionTable.PSVersion
|
||||
$shouldRedirectStdErr = $psVersion.Major -ge 7 -and $psVersion.Minor -ge 1
|
||||
if ($shouldRedirectStdErr) {
|
||||
# Redirect everything to $null.
|
||||
& $command *> $null
|
||||
$isErrorStreamIssueFixed = $psVersion.Major -ge 7 -and $psVersion.Minor -ge 1
|
||||
if ($isErrorStreamIssueFixed) {
|
||||
# Execute the command with no redirection.
|
||||
& $command
|
||||
}
|
||||
else {
|
||||
# Otherwise redirect everything _but_ the Error stream to $null. See
|
||||
@@ -38,6 +38,13 @@ function Invoke-SilentlyIfPossible($command) {
|
||||
}
|
||||
}
|
||||
|
||||
function Test-GitConfigLongpaths {
|
||||
$longpathsEnabled = git config --system core.longpaths
|
||||
if ($longpathsEnabled -ne "true") {
|
||||
Write-Output "Git is not configured to allow long paths. This can cause issues with Shorebird's Flutter checkout. Please run 'git config --system core.longpaths true' to enable long paths."
|
||||
}
|
||||
}
|
||||
|
||||
function Test-GitInstalled {
|
||||
if (Get-Command git -ErrorAction SilentlyContinue) {
|
||||
Write-Debug "Git is installed."
|
||||
@@ -100,17 +107,17 @@ function Update-Flutter {
|
||||
Write-Output "Updating Flutter..."
|
||||
|
||||
if (!(Test-Path $flutterPath)) {
|
||||
Invoke-SilentlyIfPossible {
|
||||
Invoke-SilentlyIfNeeded {
|
||||
git clone --filter=tree:0 https://github.com/shorebirdtech/flutter.git --no-checkout "$flutterPath"
|
||||
}
|
||||
}
|
||||
else {
|
||||
Invoke-SilentlyIfPossible {
|
||||
Invoke-SilentlyIfNeeded {
|
||||
git -C "$flutterPath" fetch
|
||||
}
|
||||
}
|
||||
|
||||
Invoke-SilentlyIfPossible {
|
||||
Invoke-SilentlyIfNeeded {
|
||||
# -c to avoid printing a warning about being in a detached head state.
|
||||
git -C "$flutterPath" -c advice.detachedHead=false checkout "$flutterVersion"
|
||||
}
|
||||
@@ -152,6 +159,8 @@ function Update-Shorebird {
|
||||
|
||||
Test-GitInstalled
|
||||
|
||||
Test-GitConfigLongpaths
|
||||
|
||||
if (Test-ShorebirdNeedsUpdate) {
|
||||
Update-Shorebird
|
||||
}
|
||||
|
||||
@@ -63,6 +63,7 @@ words:
|
||||
- libplist
|
||||
- lldb
|
||||
- logcat
|
||||
- longpaths
|
||||
- lproj
|
||||
- metadatas
|
||||
- mktemp
|
||||
|
||||
Reference in New Issue
Block a user