Unverified Commit 8f59fdd2 authored by Jonah Williams's avatar Jonah Williams Committed by GitHub

[flutter_tools] move mingit path addition back to flutter.bat (#59369)

fixes #57802

For users without git installed, flutter on windows bundles mingit. This needs to be added to the PATH in the main script, not the executed script, so that it is available to the tool
parent f7f019aa
......@@ -15,6 +15,21 @@ SETLOCAL ENABLEDELAYEDEXPANSION
FOR %%i IN ("%~dp0..") DO SET FLUTTER_ROOT=%%~fi
REM If available, add location of bundled mingit to PATH
SET mingit_path=%FLUTTER_ROOT%\bin\mingit\cmd
IF EXIST "%mingit_path%" SET PATH=%PATH%;%mingit_path%
REM Test if Git is available on the Host
where /q git || ECHO Error: Unable to find git in your PATH. && EXIT /B 1
REM Test if the flutter directory is a git clone, otherwise git rev-parse HEAD would fail
IF NOT EXIST "%flutter_root%\.git" (
ECHO Error: The Flutter directory is not a clone of the GitHub project.
ECHO The flutter tool requires Git in order to operate properly;
ECHO to set up Flutter, run the following command:
ECHO git clone -b stable https://github.com/flutter/flutter.git
EXIT /B 1
)
REM Include shared scripts in shared.bat
SET shared_bin=%FLUTTER_ROOT%/bin/internal/shared.bat
CALL "%shared_bin%"
......
......@@ -26,21 +26,6 @@ SET pub_cache_path=%FLUTTER_ROOT%\.pub-cache
SET dart=%dart_sdk_path%\bin\dart.exe
SET pub=%dart_sdk_path%\bin\pub.bat
REM If available, add location of bundled mingit to PATH
SET mingit_path=%FLUTTER_ROOT%\bin\mingit\cmd
IF EXIST "%mingit_path%" SET PATH=%PATH%;%mingit_path%
REM Test if Git is available on the Host
where /q git || ECHO Error: Unable to find git in your PATH. && EXIT /B 1
REM Test if the flutter directory is a git clone, otherwise git rev-parse HEAD would fail
IF NOT EXIST "%flutter_root%\.git" (
ECHO Error: The Flutter directory is not a clone of the GitHub project.
ECHO The flutter tool requires Git in order to operate properly;
ECHO to set up Flutter, run the following command:
ECHO git clone -b stable https://github.com/flutter/flutter.git
EXIT /B 1
)
REM Detect which PowerShell executable is available on the Host
REM PowerShell version <= 5: PowerShell.exe
REM PowerShell version >= 6: pwsh.exe
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment