Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): new worktree threads start in a repository with no commits #34968

Openjuliusmarmingewants to merge 7 commits intomain fromrefs/pull/34968/headopened View on GitHub

Showing 2 changed files with 99 additions and 2 deletions (loading 1).

x
0 of 2 viewed, 2 left
99 additions and 2 deletionsapps/server/src/orchestration-v2/ThreadLaunchService.test.tsModified
View file
@@ -212,7 +212,7 @@
fetchWorktreeBaseCommit:
options.fetchWorktreeBaseCommit ??
(() => Effect.succeed({ commitSha: "remote-main-sha", remoteRefName: "origin/main" })),
- hasCommit: options.hasCommit ?? (() => Effect.succeed(false)),
+ hasCommit: options.hasCommit ?? (({ refName }) => Effect.succeed(refName === "HEAD")),
currentBranch: () => Effect.succeed(null),
resolveWorktreeBaseRemote: () => Effect.succeed({ remoteName: "origin", branchName: "main" }),
remoteExists: options.remoteExists ?? (() => Effect.succeed(true)),
@@ -990,7 +990,8 @@
[projectId]: { branchNamingMode: "static", branchNamePrefix: scenario.prefix },
- hasCommit: ({ refName }) => Effect.succeed(refName === `refs/heads/${scenario.collision}`),
+ hasCommit: ({ refName }) =>
+ Effect.succeed(refName === "HEAD" || refName === `refs/heads/${scenario.collision}`),
generateBranchName: () =>
Deferred.succeed(namingAttempted, undefined).pipe(
Effect.andThen(
@@ -1288,6 +1289,102 @@
+it.effect.each([
+ { name: "a repository with no commits", setup: [], baseRef: "main", worktree: false },
+ {
+ name: "an orphan branch beside remote-tracking branches",
+ setup: [