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 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
a718caeb08
commit
7e7bd985c2
+33
-18
@@ -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%"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user