Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

fix(scripts): scan all where bash results for Git for Windows

Oii611162d689109549
diff --git a/scripts/run-dev-win.cmd b/scripts/run-dev-win.cmd
index 06532fc412..4a1d5151ba 100644
--- a/scripts/run-dev-win.cmd
+++ b/scripts/run-dev-win.cmd
@@ -11,22 +11,16 @@ if not defined GIT_BASH if exist "%LOCALAPPDATA%\Programs\Git\bin\bash.exe" set
if defined GIT_BASH goto :found
-rem Resolve bash from PATH, but only accept a Git for Windows bash.exe.
-set "BASH_PATH="
-for /f "delims=" %%i in ('where bash 2^>nul') do if not defined BASH_PATH set "BASH_PATH=%%i"
-
-if not defined BASH_PATH goto :notfound
-if /i not "%BASH_PATH:~-4%"==".exe" goto :notfound
-if not exist "%BASH_PATH%" goto :notfound
-
-for %%i in ("%BASH_PATH%") do set "BASH_DIR=%%~dpi"
-
-if exist "%BASH_DIR%..\cmd\git.exe" set "GIT_BASH=%BASH_PATH%"
-if not defined GIT_BASH if exist "%BASH_DIR%..\..\cmd\git.exe" set "GIT_BASH=%BASH_PATH%"
-if not defined GIT_BASH if exist "%BASH_DIR%..\..\mingw64\bin\git.exe" set "GIT_BASH=%BASH_PATH%"
-
-if not defined GIT_BASH goto :notfound
-goto :found
+rem Scan every where bash result and accept the first Git for Windows bash.exe.
+for /f "delims=" %%i in ('where bash 2^>nul') do (
+ if /i "%%~xi"==".exe" if exist "%%i" (
+ if exist "%%~dpi..\cmd\git.exe" set "GIT_BASH=%%i" & goto :found
+ if exist "%%~dpi..\..\cmd\git.exe" set "GIT_BASH=%%i" & goto :found
+ if exist "%%~dpi..\..\mingw64\bin\git.exe" set "GIT_BASH=%%i" & goto :found
+ )
+)
+
+goto :notfound
:notfound
echo [run-dev-win] Git Bash not found.