fix(data): merge preflights ignore untracked files in target working tree
HasChangesAsync counted untracked files, so a stray file in the shared target working dir (e.g. left by a concurrent session) blocked merge preflights even though nothing tracked changed. Add an includeUntracked overload defaulting to true, and pass includeUntracked: false only from the two target-working-tree merge preflights (TaskMergeService.MergeAsync, PlanningMergeOrchestrator.StartAsync). Auto-commit and the worktree cleanup data-loss guard keep counting untracked files, since those callers need to know about them.
This commit is contained in:
@@ -115,7 +115,7 @@ public sealed class TaskMergeService
|
||||
return Blocked("working directory is not a git repository");
|
||||
if (await _git.IsMidMergeAsync(list.WorkingDir, ct))
|
||||
return Blocked("target working directory is mid-merge");
|
||||
if (await _git.HasChangesAsync(list.WorkingDir, ct))
|
||||
if (await _git.HasChangesAsync(list.WorkingDir, includeUntracked: false, ct))
|
||||
return Blocked("target working tree has uncommitted changes");
|
||||
|
||||
var currentBranch = await _git.GetCurrentBranchAsync(list.WorkingDir, ct);
|
||||
|
||||
@@ -87,7 +87,7 @@ public sealed class PlanningMergeOrchestrator
|
||||
if (await _git.IsMidMergeAsync(workingDir, ct))
|
||||
throw new InvalidOperationException(
|
||||
"repo is mid-merge; use AbortPlanningMerge to reset the repository, then Approve again");
|
||||
if (await _git.HasChangesAsync(workingDir, ct))
|
||||
if (await _git.HasChangesAsync(workingDir, includeUntracked: false, ct))
|
||||
throw new InvalidOperationException("working tree has uncommitted changes");
|
||||
|
||||
var idsToMerge = new List<string>();
|
||||
|
||||
Reference in New Issue
Block a user