From 4b22f52c7e9251a9aa8d481c99411d4729fbeb80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Padez?= Date: Wed, 19 Aug 2026 13:00:32 +0000 Subject: [PATCH] update a plugin whose local branch no longer exists on the remote MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Update button failed with "couldn't find remote ref main" on every checkout made before the plugin repositories were standardised on `master`. It pulled `origin `, and the local branch and the remote's default had stopped agreeing — so the button could never work again on exactly the installs that most needed it. Now `git fetch origin HEAD` and a fast-forward: HEAD resolves to whatever the remote's default is, so the local name stops mattering, and the merge applies it to whichever branch the checkout happens to be on. Fourth time today that naming a branch was the bug — the marketplace icon URLs, the capabilities sync, the setup script, and now this. The rule that keeps holding: fetch HEAD, never a name. Verified by reproducing it — renamed a real checkout to `main`, pulled against a remote that has only `master`, and it succeeded. Co-Authored-By: Claude Opus 5 --- src/servers/plugins/update.ts | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/servers/plugins/update.ts b/src/servers/plugins/update.ts index 239951ed..9d6c227a 100644 --- a/src/servers/plugins/update.ts +++ b/src/servers/plugins/update.ts @@ -73,7 +73,20 @@ export async function pullPlugin(appName: string, onLog?: OnLog): Promise`. + // + // The local branch and the remote's default are two different things, and they stopped agreeing the + // day the plugin repositories were standardised: a checkout made before that is on `main`, the remote + // has only `master`, and `git pull origin main` fails with "couldn't find remote ref main" — an Update + // button that can never work again on exactly the installs that most need it. + // + // `HEAD` resolves to whatever the remote's default is, so the local name stops mattering. The + // fast-forward then applies it to whichever branch this checkout happens to be on. + const fetched = await git(dir, ['fetch', 'origin', 'HEAD']); + if (fetched.code !== 0) { + return { ok: false, updated: false, before, after: before, error: fetched.err || 'git fetch failed' }; + } + const pulled = await git(dir, ['merge', '--ff-only', 'FETCH_HEAD']); if (pulled.code !== 0) { return { ok: false, updated: false, before, after: before, error: pulled.err || pulled.out || 'git pull failed' }; }