Skip to content

Commit e236ae0

Browse files
fix(server): a branch whose local upstream was deleted publishes under its full name
Main publishes a branch that tracks a local branch under its full local name, so a local branch named like origin/main never lands on remote main. Keep that rule when the local upstream has since been deleted and the branch takes the republish path. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 9d56514 commit e236ae0

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

‎apps/server/src/vcs/GitVcsDriverCore.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7369,7 +7369,7 @@ it.layer(layerTest)("GitVcsDriver core integration", (it) => {
73697369
cwd,
73707370
null,
73717371
);
7372-
assert.deepInclude(localUpstreamGone, { upstreamBranch: "origin/push" });
7372+
assert.deepInclude(localUpstreamGone, { upstreamBranch: "origin/feature/push" });
73737373

73747374
yield* git(cwd, ["push", "fork", "HEAD:refs/heads/release"]);
73757375
yield* git(cwd, ["branch", "-u", "fork/release"]);

‎apps/server/src/vcs/GitVcsDriverCore.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2872,7 +2872,10 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function*
28722872
}
28732873
const remoteName = yield* resolvePushRemoteName(cwd, branch, goneUpstream?.remoteName);
28742874
if (!remoteName) return null;
2875-
const branchName = goneUpstream?.branchName ?? (yield* resolvePublishBranchName(cwd, branch));
2875+
// A gone local upstream still gets the full local name, as below.
2876+
const branchName =
2877+
goneUpstream?.branchName ??
2878+
(configuredRemoteName === "." ? branch : yield* resolvePublishBranchName(cwd, branch));
28762879
return { remoteName, branchName, publishes: true, upstream: goneBaseUpstream };
28772880
}
28782881

0 commit comments

Comments
 (0)