Skip to content

Commit 8f59fdd

Browse files
author
Jonah Williams
authored
[flutter_tools] move mingit path addition back to flutter.bat (flutter#59369)
fixes flutter#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
1 parent f7f019a commit 8f59fdd

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

bin/flutter.bat

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,21 @@ SETLOCAL ENABLEDELAYEDEXPANSION
1515

1616
FOR %%i IN ("%~dp0..") DO SET FLUTTER_ROOT=%%~fi
1717

18+
REM If available, add location of bundled mingit to PATH
19+
SET mingit_path=%FLUTTER_ROOT%\bin\mingit\cmd
20+
IF EXIST "%mingit_path%" SET PATH=%PATH%;%mingit_path%
21+
22+
REM Test if Git is available on the Host
23+
where /q git || ECHO Error: Unable to find git in your PATH. && EXIT /B 1
24+
REM Test if the flutter directory is a git clone, otherwise git rev-parse HEAD would fail
25+
IF NOT EXIST "%flutter_root%\.git" (
26+
ECHO Error: The Flutter directory is not a clone of the GitHub project.
27+
ECHO The flutter tool requires Git in order to operate properly;
28+
ECHO to set up Flutter, run the following command:
29+
ECHO git clone -b stable https://github.com/flutter/flutter.git
30+
EXIT /B 1
31+
)
32+
1833
REM Include shared scripts in shared.bat
1934
SET shared_bin=%FLUTTER_ROOT%/bin/internal/shared.bat
2035
CALL "%shared_bin%"

bin/internal/shared.bat

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -26,21 +26,6 @@ SET pub_cache_path=%FLUTTER_ROOT%\.pub-cache
2626
SET dart=%dart_sdk_path%\bin\dart.exe
2727
SET pub=%dart_sdk_path%\bin\pub.bat
2828

29-
REM If available, add location of bundled mingit to PATH
30-
SET mingit_path=%FLUTTER_ROOT%\bin\mingit\cmd
31-
IF EXIST "%mingit_path%" SET PATH=%PATH%;%mingit_path%
32-
33-
REM Test if Git is available on the Host
34-
where /q git || ECHO Error: Unable to find git in your PATH. && EXIT /B 1
35-
REM Test if the flutter directory is a git clone, otherwise git rev-parse HEAD would fail
36-
IF NOT EXIST "%flutter_root%\.git" (
37-
ECHO Error: The Flutter directory is not a clone of the GitHub project.
38-
ECHO The flutter tool requires Git in order to operate properly;
39-
ECHO to set up Flutter, run the following command:
40-
ECHO git clone -b stable https://github.com/flutter/flutter.git
41-
EXIT /B 1
42-
)
43-
4429
REM Detect which PowerShell executable is available on the Host
4530
REM PowerShell version <= 5: PowerShell.exe
4631
REM PowerShell version >= 6: pwsh.exe

0 commit comments

Comments
 (0)