feat(git): add ff-only merge and allow a merged worktree without merge commit

This commit is contained in:
mika kuns
2026-10-01 11:25:47 +02:00
parent dc73f138d2
commit 724ad90f88
2 changed files with 9 additions and 1 deletions
+8
View File
@@ -450,6 +450,14 @@ public sealed class GitService
return (exitCode, stderr); return (exitCode, stderr);
} }
/// <summary><c>git merge --ff-only</c>: moves the checked-out branch to <paramref name="sourceRef"/> or fails without touching it.</summary>
public async Task<(int ExitCode, string Stderr)> MergeFastForwardOnlyAsync(
string worktreePath, string sourceRef, CancellationToken ct = default)
{
var (exitCode, _, stderr) = await RunGitAsync(worktreePath, ["merge", "--ff-only", sourceRef], ct);
return (exitCode, stderr);
}
public async Task MergeAbortAsync(string repoDir, CancellationToken ct = default) public async Task MergeAbortAsync(string repoDir, CancellationToken ct = default)
{ {
var (exitCode, _, stderr) = await RunGitAsync(repoDir, ["merge", "--abort"], ct); var (exitCode, _, stderr) = await RunGitAsync(repoDir, ["merge", "--abort"], ct);
@@ -36,7 +36,7 @@ public sealed class WorktreeRepository
.ExecuteUpdateAsync(s => s.SetProperty(w => w.State, state), ct); .ExecuteUpdateAsync(s => s.SetProperty(w => w.State, state), ct);
} }
public async Task SetMergedAsync(string taskId, string mergeCommit, CancellationToken ct = default) public async Task SetMergedAsync(string taskId, string? mergeCommit, CancellationToken ct = default)
{ {
await _context.Worktrees await _context.Worktrees
.Where(w => w.TaskId == taskId) .Where(w => w.TaskId == taskId)