mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-06-13 00:07:59 +02:00
Extract helper function doRewordEditor
No behavior change, just a preparation for the next commit.
This commit is contained in:
parent
48df9b7f4e
commit
b8d33b8f7b
@ -226,6 +226,26 @@ func (self *LocalCommitsController) reword(commit *models.Commit) error {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (self *LocalCommitsController) doRewordEditor() error {
|
||||||
|
self.c.LogAction(self.c.Tr.Actions.RewordCommit)
|
||||||
|
|
||||||
|
if self.context().GetSelectedLineIdx() == 0 {
|
||||||
|
return self.c.RunSubprocessAndRefresh(self.os.Cmd.New("git commit --allow-empty --amend --only"))
|
||||||
|
}
|
||||||
|
|
||||||
|
subProcess, err := self.git.Rebase.RewordCommitInEditor(
|
||||||
|
self.model.Commits, self.context().GetSelectedLineIdx(),
|
||||||
|
)
|
||||||
|
if err != nil {
|
||||||
|
return self.c.Error(err)
|
||||||
|
}
|
||||||
|
if subProcess != nil {
|
||||||
|
return self.c.RunSubprocessAndRefresh(subProcess)
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func (self *LocalCommitsController) rewordEditor(commit *models.Commit) error {
|
func (self *LocalCommitsController) rewordEditor(commit *models.Commit) error {
|
||||||
midRebase, err := self.handleMidRebaseCommand("reword", commit)
|
midRebase, err := self.handleMidRebaseCommand("reword", commit)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -236,27 +256,9 @@ func (self *LocalCommitsController) rewordEditor(commit *models.Commit) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return self.c.Confirm(types.ConfirmOpts{
|
return self.c.Confirm(types.ConfirmOpts{
|
||||||
Title: self.c.Tr.RewordInEditorTitle,
|
Title: self.c.Tr.RewordInEditorTitle,
|
||||||
Prompt: self.c.Tr.RewordInEditorPrompt,
|
Prompt: self.c.Tr.RewordInEditorPrompt,
|
||||||
HandleConfirm: func() error {
|
HandleConfirm: self.doRewordEditor,
|
||||||
self.c.LogAction(self.c.Tr.Actions.RewordCommit)
|
|
||||||
|
|
||||||
if self.context().GetSelectedLineIdx() == 0 {
|
|
||||||
return self.c.RunSubprocessAndRefresh(self.os.Cmd.New("git commit --allow-empty --amend --only"))
|
|
||||||
}
|
|
||||||
|
|
||||||
subProcess, err := self.git.Rebase.RewordCommitInEditor(
|
|
||||||
self.model.Commits, self.context().GetSelectedLineIdx(),
|
|
||||||
)
|
|
||||||
if err != nil {
|
|
||||||
return self.c.Error(err)
|
|
||||||
}
|
|
||||||
if subProcess != nil {
|
|
||||||
return self.c.RunSubprocessAndRefresh(subProcess)
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user