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

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

Co-authored-by: Jonah Williams <jonahwilliams@google.com>
diff --git a/bin/flutter.bat b/bin/flutter.bat
index 36b96fd..168c1537 100644
--- a/bin/flutter.bat
+++ b/bin/flutter.bat
@@ -15,6 +15,21 @@
 
 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 cd95979..efc7180 100644
--- a/bin/internal/shared.bat
+++ b/bin/internal/shared.bat
@@ -26,21 +26,6 @@
 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