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%"