From 6eab57aa6ec0b8bf40b909b8f9daa4274b3f0aa5 Mon Sep 17 00:00:00 2001 From: Sawyer Date: Fri, 18 Sep 2026 02:13:13 -0700 Subject: [PATCH] fix(web): configure the origin remote before fetching an asset in the browser (CL-8520) --- apps/web/src/git-fetch.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/web/src/git-fetch.ts b/apps/web/src/git-fetch.ts index ade7bd0e1..4db4ab797 100644 --- a/apps/web/src/git-fetch.ts +++ b/apps/web/src/git-fetch.ts @@ -21,11 +21,14 @@ async function cloneAndFetchMain(args: { const dir = "/repo"; await fs.promises.mkdir(dir); await git.init({ fs, dir, defaultBranch: "main" }); + // isomorphic-git needs a configured remote to derive its refspec; a bare + // `url` on a fresh repo fails with "Could not find a fetch refspec". + await git.addRemote({ fs, dir, remote: "origin", url: args.url }); await git.fetch({ fs, http, dir, - url: args.url, + remote: "origin", ref: MAIN_REF, // The hub's git server advertises no `shallow` capability, so a // depth-limited fetch is rejected outright; fetch the full branch.