From 7e7bd985c28176e66a91170879e90c1bc73d243b Mon Sep 17 00:00:00 2001 From: Brandon Li Date: Sun, 30 Aug 2026 17:04:04 -0500 Subject: [PATCH] Name the master branch explicitly when cloning and pulling A bare `git clone` follows whatever the remote advertises as its default branch. Pushing --all to a fresh Gitea repo left that default pointing at autobuyer, so setup cloned a branch predating the build fixes and failed at `next build` on an error that had already been fixed on master. The Gitea default is corrected, but the script no longer depends on it: clone passes --branch master, and the update path fetches, checks out master and pulls it by name. That also recovers a checkout already stranded on the wrong branch, rather than needing the folder deleted. Co-Authored-By: Claude Opus 5 --- setup-windows.bat | 51 ++++++++++++++++++++++++++++++----------------- 1 file changed, 33 insertions(+), 18 deletions(-) diff --git a/setup-windows.bat b/setup-windows.bat index 6daba00..43ee777 100644 --- a/setup-windows.bat +++ b/setup-windows.bat @@ -180,24 +180,39 @@ echo Installing to: %TARGET% echo. REM -------------------------------------------------------------- clone / pull -if exist "%TARGET%\.git" ( - echo [1/5] Existing checkout found - pulling latest... - pushd "%TARGET%" - git pull --ff-only - if errorlevel 1 ( - popd - echo [X] git pull failed. Resolve local changes and re-run. - goto :fail - ) - popd -) else ( - echo [1/5] Cloning %REPO_URL% ... - git clone "%REPO_URL%" "%TARGET%" - if errorlevel 1 ( - echo [X] Clone failed. Check network access to git.juicerroom.com. - goto :fail - ) -) +REM The branch is named explicitly throughout. A bare `git clone` follows the +REM remote's default branch, which is not necessarily master - and an existing +REM checkout may be sitting on a stale branch from before that was corrected. +if exist "%TARGET%\.git" goto :repo_update +echo [1/5] Cloning %REPO_URL% ... +git clone --branch master "%REPO_URL%" "%TARGET%" +if errorlevel 1 goto :clone_failed +goto :repo_ready + +:clone_failed +echo [X] Clone failed. Check network access to git.juicerroom.com. +goto :fail + +:repo_update +echo [1/5] Existing checkout found - switching to master and pulling... +pushd "%TARGET%" +git fetch origin +if errorlevel 1 goto :pull_failed +git checkout master +if errorlevel 1 goto :pull_failed +git pull --ff-only origin master +if errorlevel 1 goto :pull_failed +popd +goto :repo_ready + +:pull_failed +popd +echo [X] Could not update the checkout. If you have local changes, either +echo commit them or delete this folder and re-run to clone fresh: +echo %TARGET% +goto :fail + +:repo_ready pushd "%TARGET%"