From 2174762315ac52f497337d19421c10f979f07eb7 Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Thu, 17 Apr 2025 19:46:41 +0200 Subject: [PATCH] Inline fetchAux into call site It's only called from this one place, and the call is a one-liner, so it makes more sense to inline the code there. --- pkg/gui/controllers/files_controller.go | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/pkg/gui/controllers/files_controller.go b/pkg/gui/controllers/files_controller.go index 44f65752d..2746afd32 100644 --- a/pkg/gui/controllers/files_controller.go +++ b/pkg/gui/controllers/files_controller.go @@ -1189,23 +1189,19 @@ func (self *FilesController) onClickMain(opts gocui.ViewMouseBindingOpts) error func (self *FilesController) fetch() error { return self.c.WithWaitingStatus(self.c.Tr.FetchingStatus, func(task gocui.Task) error { - return self.fetchAux(task) + self.c.LogAction("Fetch") + err := self.c.Git().Sync.Fetch(task) + + if err != nil && strings.Contains(err.Error(), "exit status 128") { + return errors.New(self.c.Tr.PassUnameWrong) + } + + _ = self.c.Refresh(types.RefreshOptions{Scope: []types.RefreshableView{types.BRANCHES, types.COMMITS, types.REMOTES, types.TAGS}, Mode: types.ASYNC}) + + return err }) } -func (self *FilesController) fetchAux(task gocui.Task) (err error) { - self.c.LogAction("Fetch") - err = self.c.Git().Sync.Fetch(task) - - if err != nil && strings.Contains(err.Error(), "exit status 128") { - return errors.New(self.c.Tr.PassUnameWrong) - } - - _ = self.c.Refresh(types.RefreshOptions{Scope: []types.RefreshableView{types.BRANCHES, types.COMMITS, types.REMOTES, types.TAGS}, Mode: types.ASYNC}) - - return err -} - // Couldn't think of a better term than 'normalised'. Alas. // The idea is that when you select a range of nodes, you will often have both // a node and its parent node selected. If we are trying to discard changes to the