From 1b249b1013f00e5c933a03f517ce23b2a2c83f3c Mon Sep 17 00:00:00 2001 From: Andrej730 Date: Fri, 21 Nov 2025 12:41:46 +0500 Subject: [PATCH] build-deps - fix very very old bug with `GitCloneAndCheckoutRevision` not always checking out revision Since this if-block happens in parentheses, then all `%VAR%` are expanded at the start and then `%ERRORLEVEL%` and `%RET%` values have no relation to the actual result of `git clone`. So if user were (un)lucky, then `%RET%` would be not yet set to "0" (by the previous function call), then it would skip checking out revision. `GitCloneOrPullRepository` had similar issue, but it was never used anywhere. --- win/build-deps.cmd | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/win/build-deps.cmd b/win/build-deps.cmd index e8fc0924d7..409a2f2f8e 100644 --- a/win/build-deps.cmd +++ b/win/build-deps.cmd @@ -836,7 +836,7 @@ if not exist "%~2". ( call cecho.cmd 0 13 "Cloning %DEPENDENCY_NAME% into %~2." pushd "%DEPS_DIR%" call git clone %1 %2 - set RET=%ERRORLEVEL% + set RET=!ERRORLEVEL! ) else ( call cecho.cmd 0 13 "%DEPENDENCY_NAME% already cloned. Pulling latest changes." git reset --hard @@ -855,8 +855,8 @@ if not exist "%~2". ( call cecho.cmd 0 13 "Cloning %DEPENDENCY_NAME% into %~2." pushd "%DEPS_DIR%" call git clone %1 %2 - set RET=%ERRORLEVEL% - if not "%RET%"=="0" exit /b %RET% + set RET=!ERRORLEVEL! + if not "!RET!"=="0" exit /b !RET! popd ) else ( call cecho.cmd 0 13 "%DEPENDENCY_NAME% already cloned."