Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): deleted worktree threads recover from a detached checkout #26758

Mergedshivamhwp(GitHub profile, opens in a new tab)merged 1 commit intomain fromrefs/pull/26758/headmerged by maria-rcks View on GitHub

Showing 2 changed files with 108 additions and 38 deletions.

x
0 of 2 viewed, 2 left
67 additions and 31 deletionsapps/server/src/orchestration-v2/ProviderTurnStartService.test.tsModified
View file
@@ -788,7 +788,7 @@
​
effectIt.effect(
- "recovers the thread branch tip, falls back to the current project branch, and rejects detached HEAD",
+ "recovers the local or pushed thread tip, else the current branch, remote default, or detached HEAD",
() =>
Effect.gen(function* () {
const fileSystem = yield* FileSystem.FileSystem;
@@ -797,6 +797,7 @@
const driver = yield* GitVcsDriver.GitVcsDriver;
const root = yield* fileSystem.makeTempDirectoryScoped({ prefix: "t3-recreate-repo-" });
const workspaceRoot = path.join(root, "project");
+ const originRoot = path.join(root, "origin.git");
const worktreesDir = path.join(root, "worktrees");
const worktreePath = path.join(worktreesDir, "project", "restore");
yield* fileSystem.makeDirectory(workspaceRoot);
@@ -804,10 +805,19 @@
driver
.execute({ operation: "test.worktreeRecovery", cwd, args })
.pipe(Effect.map((result) => result.stdout.trim()));
+ const branchConfig = (key: string) =>
+ git(workspaceRoot, ["config", "--get", `branch.feature/restore.${key}`]).pipe(
+ Effect.orElseSucceed(() => ""),
+ );
+ yield* git(root, ["init", "--bare", "-b", "main", originRoot]);
yield* git(workspaceRoot, ["init", "-b", "main"]);
yield* git(workspaceRoot, ["config", "user.name", "Test"]);