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.
|
echo.
|
||||||
|
|
||||||
REM -------------------------------------------------------------- clone / pull
|
REM -------------------------------------------------------------- clone / pull
|
||||||
if exist "%TARGET%\.git" (
|
REM The branch is named explicitly throughout. A bare `git clone` follows the
|
||||||
echo [1/5] Existing checkout found - pulling latest...
|
REM remote's default branch, which is not necessarily master - and an existing
|
||||||
pushd "%TARGET%"
|
REM checkout may be sitting on a stale branch from before that was corrected.
|
||||||
git pull --ff-only
|
if exist "%TARGET%\.git" goto :repo_update
|
||||||
if errorlevel 1 (
|
echo [1/5] Cloning %REPO_URL% ...
|
||||||
popd
|
git clone --branch master "%REPO_URL%" "%TARGET%"
|
||||||
echo [X] git pull failed. Resolve local changes and re-run.
|
if errorlevel 1 goto :clone_failed
|
||||||
goto :fail
|
goto :repo_ready
|
||||||
)
|
|
||||||
popd
|
:clone_failed
|
||||||
) else (
|
echo [X] Clone failed. Check network access to git.juicerroom.com.
|
||||||
echo [1/5] Cloning %REPO_URL% ...
|
goto :fail
|
||||||
git clone "%REPO_URL%" "%TARGET%"
|
|
||||||
if errorlevel 1 (
|
:repo_update
|
||||||
echo [X] Clone failed. Check network access to git.juicerroom.com.
|
echo [1/5] Existing checkout found - switching to master and pulling...
|
||||||
goto :fail
|
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%"
|
pushd "%TARGET%"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user