From 3ad167b2d718ea4986441ec3d10c092264c4f970 Mon Sep 17 00:00:00 2001 From: Wout Stiens <71498452+StiensWout@users.noreply.github.com> Date: Sat, 21 Nov 2026 20:59:32 +0100 Subject: [PATCH 1/4] test(mobile): expect Push to use existing default branch commits Co-authored-by: GPT 6.2 Sol --- .../client-runtime/src/state/gitActions.test.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/packages/client-runtime/src/state/gitActions.test.ts b/packages/client-runtime/src/state/gitActions.test.ts index 7418ed0df172b..7b1db4e9f5f47 100644 --- a/packages/client-runtime/src/state/gitActions.test.ts +++ b/packages/client-runtime/src/state/gitActions.test.ts @@ -88,6 +88,23 @@ describe("git action copy", () => { expect(resolveQuickAction({ ...pushed, isDefaultRef: true }, false, true).disabled).toBe(true); }); + it.each([ + { tracking: "with an upstream", hasUpstream: true }, + { tracking: "without an upstream", hasUpstream: false }, + ])("pushes existing commits from a clean default branch $tracking", ({ hasUpstream }) => { + const cleanDefaultBranch = status({ + refName: "main", + isDefaultRef: true, + hasUpstream, + aheadCount: 1, + }); + expect(resolveQuickAction(cleanDefaultBranch, false, true)).toMatchObject({ + disabled: false, + kind: "run_action", + action: "push", + }); + }); + it("names the host's change request in the default-branch dialog", () => { const input = { action: "commit_push_pr", branchName: "main", includesCommit: true } as const; expect( From 5c0410ed76ab0bdb7461d4989bad676089cb79c8 Mon Sep 17 00:00:00 2001 From: Wout Stiens <71498452+StiensWout@users.noreply.github.com> Date: Sat, 21 Nov 2026 21:00:06 +0100 Subject: [PATCH 2/4] fix(mobile): push clean default branches without a new commit Co-authored-by: GPT 6.2 Sol --- packages/client-runtime/src/state/gitActions.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/client-runtime/src/state/gitActions.ts b/packages/client-runtime/src/state/gitActions.ts index ece720c47d3a2..c975e640aafee 100644 --- a/packages/client-runtime/src/state/gitActions.ts +++ b/packages/client-runtime/src/state/gitActions.ts @@ -238,7 +238,7 @@ export function resolveQuickAction( label: resolve(msg("Push", { $context: "verb, git action" })), disabled: false, kind: "run_action", - action: isDefaultBranch ? "commit_push" : "push", + action: "push", }; } return { @@ -272,7 +272,7 @@ export function resolveQuickAction( label: resolve(msg("Push", { $context: "verb, git action" })), disabled: false, kind: "run_action", - action: isDefaultBranch ? "commit_push" : "push", + action: "push", }; } return { From e9d7a172823918481813c081ae0be82bf9548ba0 Mon Sep 17 00:00:00 2001 From: Wout Stiens <71498452+StiensWout@users.noreply.github.com> Date: Sat, 21 Nov 2026 21:12:08 +0100 Subject: [PATCH 3/4] fix(server): publish branches that track a local base Co-authored-by: GPT 6.2 Sol --- apps/server/src/vcs/GitVcsDriverCore.test.ts | 43 ++++++++++++++++++++ apps/server/src/vcs/GitVcsDriverCore.ts | 8 +++- 2 files changed, 49 insertions(+), 2 deletions(-) diff --git a/apps/server/src/vcs/GitVcsDriverCore.test.ts b/apps/server/src/vcs/GitVcsDriverCore.test.ts index 27f4d4eceec59..0e9ab873cbb30 100644 --- a/apps/server/src/vcs/GitVcsDriverCore.test.ts +++ b/apps/server/src/vcs/GitVcsDriverCore.test.ts @@ -9720,6 +9720,49 @@ it.layer(layerTest)("GitVcsDriver core integration", (it) => { }), ); + it.effect("publishes a new branch at the same commit as its local upstream", () => + Effect.gen(function* () { + const cwd = yield* makeTmpDir(); + const remote = yield* makeTmpDir("git-remote-"); + const { initialBranch } = yield* initRepoWithCommit(cwd); + const driver = yield* GitVcsDriver.GitVcsDriver; + yield* git(remote, ["init", "--bare"]); + yield* git(cwd, ["remote", "add", "origin", remote]); + yield* git(cwd, ["push", "-u", "origin", initialBranch]); + const remoteBase = yield* git(remote, [ + "--git-dir=.", + "rev-parse", + `refs/heads/${initialBranch}`, + ]); + yield* writeTextFile(cwd, "feature.txt", "feature\n"); + yield* git(cwd, ["add", "feature.txt"]); + const { commitSha } = yield* driver.commit(cwd, "Add feature", ""); + yield* git(cwd, ["config", "branch.autoSetupMerge", "always"]); + yield* driver.createRef({ cwd, refName: "feature/push" }); + yield* driver.switchRef({ cwd, refName: "feature/push" }); + assert.equal( + yield* git(cwd, ["rev-parse", "--symbolic-full-name", "@{upstream}"]), + `refs/heads/${initialBranch}`, + ); + + const pushed = yield* driver.pushCurrentBranch(cwd, null); + + assert.deepInclude(pushed, { + status: "pushed", + upstreamBranch: "origin/feature/push", + setUpstream: true, + }); + assert.equal( + yield* git(remote, ["--git-dir=.", "rev-parse", "refs/heads/feature/push"]), + commitSha, + ); + assert.equal( + yield* git(remote, ["--git-dir=.", "rev-parse", `refs/heads/${initialBranch}`]), + remoteBase, + ); + }), + ); + it.effect("republishes a branch whose upstream was deleted", () => Effect.gen(function* () { const cwd = yield* makeTmpDir(); diff --git a/apps/server/src/vcs/GitVcsDriverCore.ts b/apps/server/src/vcs/GitVcsDriverCore.ts index 35105aeea90e4..a6aab054d37dc 100644 --- a/apps/server/src/vcs/GitVcsDriverCore.ts +++ b/apps/server/src/vcs/GitVcsDriverCore.ts @@ -3733,8 +3733,12 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function* const destination = yield* resolvePushDestination(cwd, branch, details.hasUpstream); if (hasNoLocalDelta && details.hasUpstream) { if (!destination?.pushRemote) { - // The tracking ref reflects the fetch URL, so it says nothing about a separate push URL. - if (!destination || (yield* pushesOnlyToFetchUrl(cwd, destination.remoteName))) { + // A local upstream and a separate push URL both leave the publish destination unchecked. + if ( + !destination || + (destination.upstream?.remoteName !== "." && + (yield* pushesOnlyToFetchUrl(cwd, destination.remoteName))) + ) { return { status: "skipped_up_to_date" as const, branch, From 77058128a9e8d8ad2f1db771e55310fb449cf3c6 Mon Sep 17 00:00:00 2001 From: Wout Stiens <71498452+StiensWout@users.noreply.github.com> Date: Sat, 21 Nov 2026 21:13:49 +0100 Subject: [PATCH 4/4] chore: credit the models that worked on this change Co-authored-by: Claude Opus 5.5