Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions apps/server/src/vcs/GitVcsDriverCore.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2560,6 +2560,44 @@ it.layer(TestLayer)("GitVcsDriver core integration", (it) => {
}),
);

it.effect("still creates the worktree when the base-ref config is locked", () =>
Effect.gen(function* () {
const cwd = yield* makeTmpDir();
const { initialBranch } = yield* initRepoWithCommit(cwd);
const pathService = yield* Path.Path;
const fileSystem = yield* FileSystem.FileSystem;
const worktreePath = pathService.join(yield* makeTmpDir("git-worktrees-"), "locked-config");
yield* writeTextFile(cwd, ".git/config.lock", "");
const driver = yield* GitVcsDriver.GitVcsDriver;

const created = yield* driver.createWorktree({
cwd,
path: worktreePath,
refName: initialBranch,
newRefName: "feature/locked-config",
baseRefName: initialBranch,
});

assert.deepEqual(created.worktree, {
path: worktreePath,
refName: "feature/locked-config",
});
assert.equal(
yield* git(worktreePath, ["branch", "--show-current"]),
"feature/locked-config",
);
assert.equal(
yield* fileSystem.readFileString(pathService.join(worktreePath, "README.md")),
"# test\n",
);
assert.equal(
yield* driver.readConfigValue(worktreePath, "branch.feature/locked-config.gh-merge-base"),
null,
);
assert.equal(yield* fileSystem.exists(pathService.join(cwd, ".git/config.lock")), true);
}),
);

it.effect("reports checkout progress during parallel worktree creation", () =>
Effect.gen(function* () {
const cwd = yield* makeTmpDir();
Expand Down
9 changes: 8 additions & 1 deletion apps/server/src/vcs/GitVcsDriverCore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3186,7 +3186,14 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function*
"config",
`branch.${input.newRefName}.gh-merge-base`,
baseBranch,
]);
]).pipe(
Effect.catch((cause) =>
Effect.logWarning("worktree base-ref configuration failed; using base-branch fallback", {
worktreePath,
cause,
}),
),
);
}

return {
Expand Down
Loading