Skip to content

Commit 3b22620

Browse files
fix(server): parallel worktree launches no longer fail on .git/config lock (#25700)
Co-authored-by: Claude Opus 5.5 <[email protected]>
1 parent 1cf14a4 commit 3b22620

10 files changed

Lines changed: 594 additions & 80 deletions

File tree

‎apps/server/src/sourceControl/ServerSourceControlHost.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ export const layer = Layer.effect(
2929
fetchRemoteBranch: git.fetchRemoteBranch,
3030
fetchRemoteTrackingBranch: git.fetchRemoteTrackingBranch,
3131
setBranchUpstream: git.setBranchUpstream,
32+
createBranch: git.createBranch,
33+
writeConfigValue: git.writeConfigValue,
3234
switchRef: git.switchRef,
3335
},
3436
});

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

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ export interface ExecuteGitInput {
5757
/** With appendTruncationMarker, line callbacks continue beyond the buffer cap for progress-only consumers. */
5858
readonly keepLineCallbacksAfterTruncation?: boolean;
5959
readonly progress?: ExecuteGitProgress;
60+
/** Writes .git/config, which every worktree shares and Git locks without waiting. */
61+
readonly writesSharedConfig?: boolean;
6062
}
6163

6264
export interface ExecuteGitResult {
@@ -269,6 +271,18 @@ export interface GitFetchWorktreeBaseCommitInput {
269271
refName: string;
270272
}
271273

274+
export interface GitCreateBranchInput {
275+
readonly cwd: string;
276+
readonly branch: string;
277+
readonly startPoint: string;
278+
}
279+
280+
export interface GitWriteConfigValueInput {
281+
readonly cwd: string;
282+
readonly key: string;
283+
readonly value: string;
284+
}
285+
272286
export interface GitSetBranchUpstreamInput {
273287
cwd: string;
274288
branch: string;
@@ -387,6 +401,11 @@ export class GitVcsDriver extends Context.Service<
387401
readonly setBranchUpstream: (
388402
input: GitSetBranchUpstreamInput,
389403
) => Effect.Effect<void, GitCommandError>;
404+
/** Tracks the start point like `git branch` does. */
405+
readonly createBranch: (input: GitCreateBranchInput) => Effect.Effect<void, GitCommandError>;
406+
readonly writeConfigValue: (
407+
input: GitWriteConfigValueInput,
408+
) => Effect.Effect<void, GitCommandError>;
390409
readonly removeWorktree: (
391410
input: VcsRemoveWorktreeInput,
392411
) => Effect.Effect<void, GitCommandError>;

0 commit comments

Comments
 (0)