Remove return value of RefreshPatchBuildingPanel

This commit is contained in:
Stefan Haller 2024-09-05 10:37:53 +02:00
parent 371998e635
commit 6f0182f11c
3 changed files with 7 additions and 11 deletions

View file

@ -55,7 +55,7 @@ func (self *PatchBuildingHelper) Reset() error {
return self.c.PostRefreshUpdate(self.c.Context().Current())
}
func (self *PatchBuildingHelper) RefreshPatchBuildingPanel(opts types.OnFocusOpts) error {
func (self *PatchBuildingHelper) RefreshPatchBuildingPanel(opts types.OnFocusOpts) {
selectedLineIdx := -1
if opts.ClickedWindowName == "main" {
selectedLineIdx = opts.ClickedViewLineIdx
@ -63,20 +63,20 @@ func (self *PatchBuildingHelper) RefreshPatchBuildingPanel(opts types.OnFocusOpt
if !self.c.Git().Patch.PatchBuilder.Active() {
self.Escape()
return nil
return
}
// get diff from commit file that's currently selected
path := self.c.Contexts().CommitFiles.GetSelectedPath()
if path == "" {
return nil
return
}
from, to := self.c.Contexts().CommitFiles.GetFromAndToForDiff()
from, reverse := self.c.Modes().Diffing.GetFromAndReverseArgsForDiff(from)
diff, err := self.c.Git().WorkingTree.ShowFileDiff(from, to, reverse, path, true)
if err != nil {
return err
return
}
secondaryDiff := self.c.Git().Patch.PatchBuilder.RenderPatchForFile(patch.RenderPatchForFileOpts{
@ -94,7 +94,7 @@ func (self *PatchBuildingHelper) RefreshPatchBuildingPanel(opts types.OnFocusOpt
context.SetState(state)
if state == nil {
self.Escape()
return nil
return
}
mainContent := context.GetContentToRender(true)
@ -112,6 +112,4 @@ func (self *PatchBuildingHelper) RefreshPatchBuildingPanel(opts types.OnFocusOpt
Title: self.c.Tr.CustomPatch,
},
})
return nil
}

View file

@ -180,7 +180,7 @@ func (self *RefreshHelper) Refresh(options types.RefreshOptions) error {
}
if scopeSet.Includes(types.PATCH_BUILDING) {
refresh("patch building", func() { _ = self.patchBuildingHelper.RefreshPatchBuildingPanel(types.OnFocusOpts{}) })
refresh("patch building", func() { self.patchBuildingHelper.RefreshPatchBuildingPanel(types.OnFocusOpts{}) })
}
if scopeSet.Includes(types.MERGE_CONFLICTS) || scopeSet.Includes(types.FILES) {

View file

@ -67,9 +67,7 @@ func (self *PatchBuildingController) GetOnFocus() func(types.OnFocusOpts) {
// no need to change wrap on the secondary view because it can't be interacted with
self.c.Views().PatchBuilding.Wrap = false
// Swallowing the error here for now. This will change shortly to not
// return an error any more.
_ = self.c.Helpers().PatchBuilding.RefreshPatchBuildingPanel(opts) // FIXME
self.c.Helpers().PatchBuilding.RefreshPatchBuildingPanel(opts)
}
}