mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-04-21 12:16:54 +02:00
Extract helper function currentFromToReverseForPatchBuilding
In the next commit it will be reused for checking whether we need to reset the patch; and extracting it makes it easier to extend it for non-sticky diff ranges later in the branch.
This commit is contained in:
parent
6ad4ffea3b
commit
8e2ed8c538
@ -330,14 +330,21 @@ func (self *CommitFilesController) startPatchBuilder() error {
|
||||
commitFilesContext := self.context()
|
||||
|
||||
canRebase := commitFilesContext.GetCanRebase()
|
||||
ref := commitFilesContext.GetRef()
|
||||
to := ref.RefName()
|
||||
from, reverse := self.c.Modes().Diffing.GetFromAndReverseArgsForDiff(ref.ParentRefName())
|
||||
from, to, reverse := self.currentFromToReverseForPatchBuilding()
|
||||
|
||||
self.c.Git().Patch.PatchBuilder.Start(from, to, reverse, canRebase)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (self *CommitFilesController) currentFromToReverseForPatchBuilding() (string, string, bool) {
|
||||
commitFilesContext := self.context()
|
||||
|
||||
ref := commitFilesContext.GetRef()
|
||||
to := ref.RefName()
|
||||
from, reverse := self.c.Modes().Diffing.GetFromAndReverseArgsForDiff(ref.ParentRefName())
|
||||
return from, to, reverse
|
||||
}
|
||||
|
||||
func (self *CommitFilesController) enter(node *filetree.CommitFileNode) error {
|
||||
return self.enterCommitFile(node, types.OnFocusOpts{ClickedWindowName: "", ClickedViewLineIdx: -1})
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user