Bugfix: don't allow dropping patches from a custom patch that was made in diffing mode

The three nested `if` statements may looks strange, and you might wonder why we
don't have single one with &&. The answer is that later in this branch we will
add an `else` block to the middle one.
This commit is contained in:
Stefan Haller 2024-08-23 22:14:54 +02:00
parent 14a29d6d6f
commit 567e898e22

View file

@ -62,10 +62,19 @@ func (self *SwitchToDiffFilesController) GetOnClick() func() error {
func (self *SwitchToDiffFilesController) enter(ref types.Ref) error {
commitFilesContext := self.c.Contexts().CommitFiles
canRebase := self.context.CanRebase()
if canRebase {
if self.c.Modes().Diffing.Active() {
if self.c.Modes().Diffing.Ref != ref.RefName() {
canRebase = false
}
}
}
commitFilesContext.SetSelection(0)
commitFilesContext.SetRef(ref)
commitFilesContext.SetTitleRef(ref.Description())
commitFilesContext.SetCanRebase(self.context.CanRebase())
commitFilesContext.SetCanRebase(canRebase)
commitFilesContext.SetParentContext(self.context)
commitFilesContext.SetWindowName(self.context.GetWindowName())
commitFilesContext.ClearSearchString()