diff options
author | Stefan Haller <stefan@haller-berlin.de> | 2023-04-06 08:15:15 +0200 |
---|---|---|
committer | Stefan Haller <stefan@haller-berlin.de> | 2023-04-29 07:28:33 +0200 |
commit | 3791f0b2fa1a633b67752adb800895065abb17f2 (patch) | |
tree | 9c82aa618adde544983d6f0032bf9ffbd2b0f59f /pkg/commands | |
parent | b8fbe9756e5b2ad22b39fe7d0b8e40d88b15df84 (diff) |
Implement "move patch to selected commit" in terms of daemon
Diffstat (limited to 'pkg/commands')
-rw-r--r-- | pkg/commands/git_commands/patch.go | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/pkg/commands/git_commands/patch.go b/pkg/commands/git_commands/patch.go index 8c956529c..a09f9bce6 100644 --- a/pkg/commands/git_commands/patch.go +++ b/pkg/commands/git_commands/patch.go @@ -3,6 +3,7 @@ package git_commands import ( "fmt" + "github.com/fsmiamoto/git-todo-parser/todo" "github.com/go-errors/errors" "github.com/jesseduffield/lazygit/pkg/commands/models" "github.com/jesseduffield/lazygit/pkg/commands/patch" @@ -103,18 +104,13 @@ func (self *PatchCommands) MovePatchToSelectedCommit(commits []*models.Commit, s baseIndex := sourceCommitIdx + 1 - todoLines := self.rebase.BuildTodoLines(commits[0:baseIndex], func(commit *models.Commit, i int) string { - if i == sourceCommitIdx || i == destinationCommitIdx { - return "edit" - } else { - return "pick" - } - }) - err := self.rebase.PrepareInteractiveRebaseCommand(PrepareInteractiveRebaseCommandOpts{ baseShaOrRoot: commits[baseIndex].Sha, - todoLines: todoLines, overrideEditor: true, + changeTodoActions: []ChangeTodoAction{ + {sha: commits[sourceCommitIdx].Sha, newAction: todo.Edit}, + {sha: commits[destinationCommitIdx].Sha, newAction: todo.Edit}, + }, }).Run() if err != nil { return err |