fix(worker): stage only resolved conflict paths in continue_merge

git add -A ran against the shared target checkout, sweeping in
whatever untracked or unrelated modified files a concurrent session
left there and committing them into an unrelated merge. Stage exactly
the paths that were reported conflicted and resolved instead.
This commit is contained in:
mika kuns
2026-08-10 11:56:37 +02:00
parent 6a2a19cc9e
commit 29c79e8b8c
2 changed files with 59 additions and 1 deletions
@@ -315,7 +315,11 @@ public sealed class TaskMergeService
if (stillConflicted.Count > 0)
return new MergeResult(StatusConflict, stillConflicted, "conflicts not fully resolved");
await _git.AddAllAsync(list.WorkingDir, ct);
// Stage exactly the resolved conflict paths — never `git add -A`, which would sweep
// untracked/unrelated changes left by other sessions into this merge commit (the
// target working dir is shared).
foreach (var path in unresolved)
await _git.AddPathAsync(list.WorkingDir, path, ct);
var remaining = await _git.ListConflictedFilesAsync(list.WorkingDir, ct);
if (remaining.Count > 0)