From afa21c750704f48467ef8aef61a726a7ea93d210 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Mon, 22 Dec 2025 13:58:01 -0600 Subject: [PATCH] Remove unnecessary temp remote --- src/lib/git.ts | 96 +++++++++++++++++++------------------------------- 1 file changed, 37 insertions(+), 59 deletions(-) diff --git a/src/lib/git.ts b/src/lib/git.ts index 97289c6e..dc7b6bde 100644 --- a/src/lib/git.ts +++ b/src/lib/git.ts @@ -2260,69 +2260,47 @@ export class Git { toCreate: changes.refsToCreate.length, }); - // Add a temporary remote - const tempRemoteName = `sync-${Date.now()}`; - await git.addRemote({ - fs: this.fs, - dir, - remote: tempRemoteName, - url: cloneUrl, - }); + // Push all refs that need to be created or updated + const refsToPush = [...changes.refsToCreate, ...changes.refsToUpdate]; - try { - // Push all refs that need to be created or updated - const refsToPush = [...changes.refsToCreate, ...changes.refsToUpdate]; - - if (refsToPush.length > 0) { - for (const ref of refsToPush) { - try { - await git.push({ - fs: this.fs, - http: this.http, - dir, - remote: tempRemoteName, - ref, - force: true, // Force push to ensure refs are updated - }); - console.log(` ✓ Pushed ${ref}`); - } catch (pushError) { - console.warn(` ✗ Failed to push ${ref}:`, pushError); - } + if (refsToPush.length > 0) { + for (const ref of refsToPush) { + try { + await git.push({ + fs: this.fs, + http: this.http, + dir, + url: cloneUrl, + ref, + force: true, // Force push to ensure refs are updated + }); + console.log(` ✓ Pushed ${ref}`); + } catch (pushError) { + console.warn(` ✗ Failed to push ${ref}:`, pushError); } } - - // Delete refs that should not exist on the remote - // Note: Git push with :ref syntax deletes remote refs - if (changes.refsToDelete.length > 0) { - for (const ref of changes.refsToDelete) { - try { - await git.push({ - fs: this.fs, - http: this.http, - dir, - remote: tempRemoteName, - ref: `:${ref}`, // :ref syntax deletes the remote ref - }); - console.log(` ✓ Deleted ${ref}`); - } catch (deleteError) { - console.warn(` ✗ Failed to delete ${ref}:`, deleteError); - } - } - } - - console.log(`✓ Synced ${cloneUrl}`); - } finally { - // Clean up the temporary remote - try { - await git.deleteRemote({ - fs: this.fs, - dir, - remote: tempRemoteName, - }); - } catch { - // Ignore cleanup errors - } } + + // Delete refs that should not exist on the remote + // Note: Git push with :ref syntax deletes remote refs + if (changes.refsToDelete.length > 0) { + for (const ref of changes.refsToDelete) { + try { + await git.push({ + fs: this.fs, + http: this.http, + dir, + url: cloneUrl, + ref: `:${ref}`, // :ref syntax deletes the remote ref + }); + console.log(` ✓ Deleted ${ref}`); + } catch (deleteError) { + console.warn(` ✗ Failed to delete ${ref}:`, deleteError); + } + } + } + + console.log(`✓ Synced ${cloneUrl}`); } catch (error) { console.warn(`Failed to sync ${cloneUrl}:`, error); }