From 8f59fdd20b7369c59a6d4d51d708bfdae38e4a3b Mon Sep 17 00:00:00 2001 From: Jonah Williams Date: Mon, 15 Jun 2020 09:43:10 -0700 Subject: [PATCH] [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 --- bin/flutter.bat | 15 +++++++++++++++ bin/internal/shared.bat | 15 --------------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/bin/flutter.bat b/bin/flutter.bat index 36b96fd0f8..168c1537c3 100644 --- a/bin/flutter.bat +++ b/bin/flutter.bat @@ -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%" diff --git a/bin/internal/shared.bat b/bin/internal/shared.bat index cd95979065..efc7180dab 100644 --- a/bin/internal/shared.bat +++ b/bin/internal/shared.bat @@ -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