fix(server): preserve worktree setup after a failed hook and restart #48259
OpenUtkarshUsername(GitHub profile, opens in a new tab)wants to merge 2 commits into
main fromrefs/pull/48259/headopened View on GitHubtanstack-source added labelsbug
- @@ -319,9 +317,4 @@319317 const exists = yield* fileSystem.exists(worktreePath).pipe(Effect.orElseSucceed(() => true));320318 const leftover = exists && (yield* isLeftoverFolder(worktreePath));321319 const pending = exists && !leftover && (yield* findPendingSubmodules(worktreePath)) !== null;322- const setupOwed = exists && !leftover && checkoutsAwaitingSetup.has(worktreePath);323- if (324- (exists && !leftover && !pending && !setupOwed) ||325- !(yield* isManagedWorktreePath(worktreePath))326- )327- return;320+ if ((exists && !leftover && !pending) || !(yield* isManagedWorktreePath(worktreePath))) return;
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:M
Pushede71c22c
macroscopeapp[bot](GitHub profile, opens in a new tab) approved these changes
- @@ -344,9 +337,9 @@344337 Effect.andThen(345338 recreateMissingWorktree({ cwd: project.workspaceRoot, worktreePath, branch }),346339 ),340+ // A failed post-checkout hook can leave a usable checkout before setup runs.347341 Effect.tapError(() =>348342 fileSystem.exists(path.join(worktreePath, ".git")).pipe(349- Effect.map((checkedOut) => {350- if (checkedOut) checkoutsAwaitingSetup.add(worktreePath);351- }),352- Effect.ignore,343+ Effect.orElseSucceed(() => false),344+ Effect.flatMap((checkedOut) =>345+ checkedOut ? markSetupPending(worktreePath) : Effect.void,
Sign in to join this conversation.
macroscopeapp[bot](GitHub profile, opens in a new tab) reviewed