The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 23, 01:45 UTC
fix(server): keep worktree creation working when git config is locked (#11773)
Co-authored-by: Julius Marminge <julius0216@outlook.com>
Guillermo Casanova committed
Oct 19, 2026 at 18:11 UTC
8de7e3502c0d76a478119aa03a1914c94e014751
2 files changed
+46
-1
apps/server/src/vcs/GitVcsDriverCore.test.ts
+38
@@ -3816,6 +3816,44 @@ it.layer(layerTest)("GitVcsDriver core integration", (it) => {
3816
}),
3817
);
3818
3819
+ it.effect("still creates the worktree when the base-ref config is locked", () =>
3820
+ Effect.gen(function* () {
3821
+ const cwd = yield* makeTmpDir();
3822
+ const { initialBranch } = yield* initRepoWithCommit(cwd);
3823
+ const pathService = yield* Path.Path;
3824
+ const fileSystem = yield* FileSystem.FileSystem;
3825
+ const worktreePath = pathService.join(yield* makeTmpDir("git-worktrees-"), "locked-config");
3826
+ yield* writeTextFile(cwd, ".git/config.lock", "");
3827
+ const driver = yield* GitVcsDriver.GitVcsDriver;
3828
+
3829
+ const created = yield* driver.createWorktree({
3830
+ cwd,
3831
+ path: worktreePath,
3832
+ refName: initialBranch,
3833
+ newRefName: "feature/locked-config",
3834
+ baseRefName: initialBranch,
3835
+ });
3836
+
3837
+ assert.deepEqual(created.worktree, {
3838
+ path: worktreePath,
3839
+ refName: "feature/locked-config",
3840
+ });
3841
+ assert.equal(
3842
+ yield* git(worktreePath, ["branch", "--show-current"]),
3843
+ "feature/locked-config",
3844
+ );
3845
+ assert.equal(
3846
+ yield* fileSystem.readFileString(pathService.join(worktreePath, "README.md")),
3847
+ "# test\n",
3848
+ );
3849
+ assert.equal(
3850
+ yield* driver.readConfigValue(worktreePath, "branch.feature/locked-config.gh-merge-base"),
3851
+ null,
3852
+ );
3853
+ assert.equal(yield* fileSystem.exists(pathService.join(cwd, ".git/config.lock")), true);
3854
+ }),
3855
+ );
3856
+
3857
it.effect("reports checkout progress during parallel worktree creation", () =>
3858
Effect.gen(function* () {
3859
const cwd = yield* makeTmpDir();
apps/server/src/vcs/GitVcsDriverCore.ts
+8
-1
@@ -3601,7 +3601,14 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function*
3601
"config",
3602
`branch.${input.newRefName}.gh-merge-base`,
3603
baseBranch,
3604
- ]);
3604
+ ]).pipe(
3605
+ Effect.catchTags({
3606
+ GitCommandError: () =>
3607
+ Effect.logWarning(
3608
+ "worktree base-ref configuration failed; using base-branch fallback",
3609
+ ),
3610
+ }),
3611
+ );
3612
}
3613
}
3614