diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2023-07-09 21:09:52 +1000 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2023-07-10 17:12:21 +1000 |
commit | 6b9390409eb533fe87648be55e9db7d36b1d9ee3 (patch) | |
tree | 43e35b86a17dbee8aac245cc93c2645727b61148 /pkg/gui/controllers/sync_controller.go | |
parent | 8964cedf27cbdb81f59e2400cfc89684d7458605 (diff) |
Use an interface for tasks instead of a concrete struct
By using an interface for tasks we can use a fake implementation in tests with extra methods
Diffstat (limited to 'pkg/gui/controllers/sync_controller.go')
-rw-r--r-- | pkg/gui/controllers/sync_controller.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/pkg/gui/controllers/sync_controller.go b/pkg/gui/controllers/sync_controller.go index 79ae21e8f..9fa2da09c 100644 --- a/pkg/gui/controllers/sync_controller.go +++ b/pkg/gui/controllers/sync_controller.go @@ -139,12 +139,12 @@ type PullFilesOptions struct { } func (self *SyncController) PullAux(opts PullFilesOptions) error { - return self.c.WithLoaderPanel(self.c.Tr.PullWait, func(task *gocui.Task) error { + return self.c.WithLoaderPanel(self.c.Tr.PullWait, func(task gocui.Task) error { return self.pullWithLock(task, opts) }) } -func (self *SyncController) pullWithLock(task *gocui.Task, opts PullFilesOptions) error { +func (self *SyncController) pullWithLock(task gocui.Task, opts PullFilesOptions) error { self.c.LogAction(opts.Action) err := self.c.Git().Sync.Pull( @@ -167,7 +167,7 @@ type pushOpts struct { } func (self *SyncController) pushAux(opts pushOpts) error { - return self.c.WithLoaderPanel(self.c.Tr.PushWait, func(task *gocui.Task) error { + return self.c.WithLoaderPanel(self.c.Tr.PushWait, func(task gocui.Task) error { self.c.LogAction(self.c.Tr.Actions.Push) err := self.c.Git().Sync.Push( task, |