fix(worker): tighten ContinueMergeAsync guards and commit error handling
This commit is contained in:
@@ -171,6 +171,7 @@ public sealed class TaskMergeService
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (wt is null) return Blocked("task has no worktree");
|
if (wt is null) return Blocked("task has no worktree");
|
||||||
|
if (wt.State != WorktreeState.Active) return Blocked($"worktree state is {wt.State}");
|
||||||
if (string.IsNullOrWhiteSpace(list.WorkingDir)) return Blocked("list has no working directory");
|
if (string.IsNullOrWhiteSpace(list.WorkingDir)) return Blocked("list has no working directory");
|
||||||
if (!await _git.IsMidMergeAsync(list.WorkingDir, ct))
|
if (!await _git.IsMidMergeAsync(list.WorkingDir, ct))
|
||||||
return Blocked("repo is not mid-merge");
|
return Blocked("repo is not mid-merge");
|
||||||
@@ -181,7 +182,8 @@ public sealed class TaskMergeService
|
|||||||
if (remaining.Count > 0)
|
if (remaining.Count > 0)
|
||||||
return new MergeResult(StatusConflict, remaining, "conflicts not fully resolved");
|
return new MergeResult(StatusConflict, remaining, "conflicts not fully resolved");
|
||||||
|
|
||||||
await _git.CommitAsync(list.WorkingDir, $"Merge branch '{wt.BranchName}'", ct);
|
try { await _git.CommitAsync(list.WorkingDir, $"Merge branch '{wt.BranchName}'", ct); }
|
||||||
|
catch (Exception ex) { return Blocked($"commit failed: {ex.Message}"); }
|
||||||
|
|
||||||
using (var ctx = _dbFactory.CreateDbContext())
|
using (var ctx = _dbFactory.CreateDbContext())
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user