mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-07-28 16:02:01 +03:00
Implement "move patch to selected commit" in terms of daemon
This commit is contained in:
@ -3,6 +3,7 @@ package git_commands
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/fsmiamoto/git-todo-parser/todo"
|
||||||
"github.com/go-errors/errors"
|
"github.com/go-errors/errors"
|
||||||
"github.com/jesseduffield/lazygit/pkg/commands/models"
|
"github.com/jesseduffield/lazygit/pkg/commands/models"
|
||||||
"github.com/jesseduffield/lazygit/pkg/commands/patch"
|
"github.com/jesseduffield/lazygit/pkg/commands/patch"
|
||||||
@ -103,18 +104,13 @@ func (self *PatchCommands) MovePatchToSelectedCommit(commits []*models.Commit, s
|
|||||||
|
|
||||||
baseIndex := sourceCommitIdx + 1
|
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{
|
err := self.rebase.PrepareInteractiveRebaseCommand(PrepareInteractiveRebaseCommandOpts{
|
||||||
baseShaOrRoot: commits[baseIndex].Sha,
|
baseShaOrRoot: commits[baseIndex].Sha,
|
||||||
todoLines: todoLines,
|
|
||||||
overrideEditor: true,
|
overrideEditor: true,
|
||||||
|
changeTodoActions: []ChangeTodoAction{
|
||||||
|
{sha: commits[sourceCommitIdx].Sha, newAction: todo.Edit},
|
||||||
|
{sha: commits[destinationCommitIdx].Sha, newAction: todo.Edit},
|
||||||
|
},
|
||||||
}).Run()
|
}).Run()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
Reference in New Issue
Block a user