feat(worker): add leaveConflictsInTree option to TaskMergeService.MergeAsync

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
mika kuns
2026-04-24 15:06:33 +02:00
parent 8afbf20613
commit e77ba35b0e
2 changed files with 68 additions and 0 deletions

View File

@@ -45,6 +45,7 @@ public sealed class TaskMergeService
string targetBranch,
bool removeWorktree,
string commitMessage,
bool leaveConflictsInTree,
CancellationToken ct)
{
TaskEntity task;
@@ -89,6 +90,11 @@ public sealed class TaskMergeService
try { files = await _git.ListConflictedFilesAsync(list.WorkingDir, ct); }
catch { files = new(); }
if (leaveConflictsInTree && files.Count > 0)
{
return new MergeResult(StatusConflict, files, null);
}
// If abort fails the repo is left mid-merge; the caller must resolve manually.
// Return Blocked (not conflict) so the UI does not offer a stale conflict list.
try { await _git.MergeAbortAsync(list.WorkingDir, ct); }
@@ -141,6 +147,14 @@ public sealed class TaskMergeService
return new MergeResult(StatusMerged, Array.Empty<string>(), cleanupWarning);
}
public Task<MergeResult> MergeAsync(
string taskId,
string targetBranch,
bool removeWorktree,
string commitMessage,
CancellationToken ct)
=> MergeAsync(taskId, targetBranch, removeWorktree, commitMessage, leaveConflictsInTree: false, ct);
public async Task<MergeTargets> GetTargetsAsync(string taskId, CancellationToken ct)
{
TaskEntity task;