The best way to control Claude Code, Codex and more from any computer or phone
fix(server): Commit finishes a merge resolved to the current branch's tree (#35778)
Julius Marminge committed
Nov 12, 2026 at 17:53 UTC
8b9f8cac5366a0b0ee6fdee4e3ab7057c8c9fd76
2 files changed
+39
-1
apps/server/src/vcs/GitVcsDriverCore.test.ts
+30
@@ -6850,6 +6850,36 @@ it.layer(layerTest)("GitVcsDriver core integration", (it) => {
6850
}),
6851
);
6852
6853
+ it.effect("reports a merge resolved to HEAD's tree as committable", () =>
6854
+ Effect.gen(function* () {
6855
+ const cwd = yield* makeTmpDir();
6856
+ const { initialBranch } = yield* initRepoWithCommit(cwd);
6857
+ const driver = yield* GitVcsDriver.GitVcsDriver;
6858
+ // A branch named MERGE_HEAD is not a merge in progress.
6859
+ yield* git(cwd, ["branch", "MERGE_HEAD"]);
6860
+ assert.isNull(yield* driver.prepareCommitContext(cwd, undefined, { includePatch: false }));
6861
+ yield* git(cwd, ["branch", "-D", "MERGE_HEAD"]);
6862
+ yield* git(cwd, ["checkout", "-b", "feature"]);
6863
+ yield* writeTextFile(cwd, "README.md", "feature version\n");
6864
+ yield* git(cwd, ["commit", "-am", "Feature"]);
6865
+ yield* git(cwd, ["checkout", initialBranch]);
6866
+ yield* writeTextFile(cwd, "README.md", "main version\n");
6867
+ yield* git(cwd, ["commit", "-am", "Main"]);
6868
+ const merge = yield* driver.execute({
6869
+ operation: "test.merge",
6870
+ cwd,
6871
+ args: ["merge", "feature"],
6872
+ allowNonZeroExit: true,
6873
+ });
6874
+ assert.equal(merge.exitCode, 1);
6875
+ yield* writeTextFile(cwd, "README.md", "main version\n");
6876
+
6877
+ assert.isNotNull(
6878
+ yield* driver.prepareCommitContext(cwd, undefined, { includePatch: false }),
6879
+ );
6880
+ }),
6881
+ );
6882
+
6883
it.effect.each([
6884
{ operation: "cherry-pick", head: "CHERRY_PICK_HEAD" },
6885
{ operation: "revert", head: "REVERT_HEAD" },
apps/server/src/vcs/GitVcsDriverCore.ts
+9
-1
@@ -2711,7 +2711,15 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function*
2711
{ env, maxOutputBytes: REVIEW_METADATA_MAX_OUTPUT_BYTES },
2712
).pipe(Effect.map((stdout) => stdout.trim()));
2713
if (stagedSummary.length === 0) {
2714
- return null;
2714
+ // Like git commit, a merge resolved to HEAD's tree still records its merge commit.
2715
+ const mergeHeadPath = yield* runGitStdout(
2716
+ "GitVcsDriver.prepareCommitContext.mergeHead",
2717
+ cwd,
2718
+ ["rev-parse", "--git-path", "MERGE_HEAD"],
2719
+ );
2720
+ if (!(yield* fileSystem.exists(path.resolve(physicalCwd, mergeHeadPath.trim())))) {
2721
+ return null;
2722
+ }
2723
}
2724
2725
// A user-supplied message needs change detection, but no patch for generation.