1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-06-17 00:18:05 +02:00

Prompt for commit message when moving a custom patch to a new commit

This commit is contained in:
Stefan Haller
2023-07-20 11:17:01 +02:00
parent 1b05ba252c
commit c21633b1be
5 changed files with 39 additions and 22 deletions

View File

@ -1,7 +1,6 @@
package git_commands
import (
"fmt"
"path/filepath"
"time"
@ -274,7 +273,12 @@ func (self *PatchCommands) MovePatchIntoIndex(commits []*models.Commit, commitId
return self.rebase.ContinueRebase()
}
func (self *PatchCommands) PullPatchIntoNewCommit(commits []*models.Commit, commitIdx int) error {
func (self *PatchCommands) PullPatchIntoNewCommit(
commits []*models.Commit,
commitIdx int,
commitSummary string,
commitDescription string,
) error {
if err := self.rebase.BeginInteractiveRebaseForCommit(commits, commitIdx, false); err != nil {
return err
}
@ -300,9 +304,7 @@ func (self *PatchCommands) PullPatchIntoNewCommit(commits []*models.Commit, comm
return err
}
head_message, _ := self.commit.GetHeadCommitMessage()
new_message := fmt.Sprintf("Split from \"%s\"", head_message)
if err := self.commit.CommitCmdObj(new_message, "").Run(); err != nil {
if err := self.commit.CommitCmdObj(commitSummary, commitDescription).Run(); err != nil {
return err
}