feat(git): add ff-only merge and allow a merged worktree without merge commit
This commit is contained in:
@@ -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)
|
||||||
|
|||||||
Reference in New Issue
Block a user