summaryrefslogtreecommitdiffstats
path: root/pkg/gui/controllers
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/gui/controllers')
-rw-r--r--pkg/gui/controllers/branches_controller.go6
-rw-r--r--pkg/gui/controllers/commits_files_controller.go4
-rw-r--r--pkg/gui/controllers/custom_patch_options_menu_action.go9
-rw-r--r--pkg/gui/controllers/files_controller.go9
-rw-r--r--pkg/gui/controllers/files_remove_controller.go3
-rw-r--r--pkg/gui/controllers/helpers/app_status_helper.go9
-rw-r--r--pkg/gui/controllers/helpers/cherry_pick_helper.go3
-rw-r--r--pkg/gui/controllers/helpers/gpg_helper.go3
-rw-r--r--pkg/gui/controllers/helpers/refresh_helper.go7
-rw-r--r--pkg/gui/controllers/helpers/refs_helper.go3
-rw-r--r--pkg/gui/controllers/helpers/suggestions_helper.go3
-rw-r--r--pkg/gui/controllers/helpers/update_helper.go5
-rw-r--r--pkg/gui/controllers/local_commits_controller.go27
-rw-r--r--pkg/gui/controllers/remote_branches_controller.go5
-rw-r--r--pkg/gui/controllers/remotes_controller.go5
-rw-r--r--pkg/gui/controllers/sub_commits_controller.go3
-rw-r--r--pkg/gui/controllers/submodules_controller.go15
-rw-r--r--pkg/gui/controllers/sync_controller.go24
-rw-r--r--pkg/gui/controllers/tags_controller.go5
-rw-r--r--pkg/gui/controllers/undo_controller.go5
20 files changed, 88 insertions, 65 deletions
diff --git a/pkg/gui/controllers/branches_controller.go b/pkg/gui/controllers/branches_controller.go
index 972ea6090..d0ef6ee69 100644
--- a/pkg/gui/controllers/branches_controller.go
+++ b/pkg/gui/controllers/branches_controller.go
@@ -5,6 +5,7 @@ import (
"fmt"
"strings"
+ "github.com/jesseduffield/gocui"
"github.com/jesseduffield/lazygit/pkg/commands/git_commands"
"github.com/jesseduffield/lazygit/pkg/commands/models"
"github.com/jesseduffield/lazygit/pkg/gui/context"
@@ -363,11 +364,12 @@ func (self *BranchesController) fastForward(branch *models.Branch) error {
},
)
- return self.c.WithLoaderPanel(message, func() error {
+ return self.c.WithLoaderPanel(message, func(task *gocui.Task) error {
if branch == self.c.Helpers().Refs.GetCheckedOutRef() {
self.c.LogAction(action)
err := self.c.Git().Sync.Pull(
+ task,
git_commands.PullOptions{
RemoteName: branch.UpstreamRemote,
BranchName: branch.UpstreamBranch,
@@ -381,7 +383,7 @@ func (self *BranchesController) fastForward(branch *models.Branch) error {
return self.c.Refresh(types.RefreshOptions{Mode: types.ASYNC})
} else {
self.c.LogAction(action)
- err := self.c.Git().Sync.FastForward(branch.Name, branch.UpstreamRemote, branch.UpstreamBranch)
+ err := self.c.Git().Sync.FastForward(task, branch.Name, branch.UpstreamRemote, branch.UpstreamBranch)
if err != nil {
_ = self.c.Error(err)
}
diff --git a/pkg/gui/controllers/commits_files_controller.go b/pkg/gui/controllers/commits_files_controller.go
index 745186df0..f7208012e 100644
--- a/pkg/gui/controllers/commits_files_controller.go
+++ b/pkg/gui/controllers/commits_files_controller.go
@@ -177,7 +177,7 @@ func (self *CommitFilesController) discard(node *filetree.CommitFileNode) error
Title: self.c.Tr.DiscardFileChangesTitle,
Prompt: prompt,
HandleConfirm: func() error {
- return self.c.WithWaitingStatus(self.c.Tr.RebasingStatus, func() error {
+ return self.c.WithWaitingStatus(self.c.Tr.RebasingStatus, func(*gocui.Task) error {
self.c.LogAction(self.c.Tr.Actions.DiscardOldFileChange)
if err := self.c.Git().Rebase.DiscardOldFileChanges(self.c.Model().Commits, self.c.Contexts().LocalCommits.GetSelectedLineIdx(), node.GetPath()); err != nil {
if err := self.c.Helpers().MergeAndRebase.CheckMergeOrRebase(err); err != nil {
@@ -205,7 +205,7 @@ func (self *CommitFilesController) edit(node *filetree.CommitFileNode) error {
func (self *CommitFilesController) toggleForPatch(node *filetree.CommitFileNode) error {
toggle := func() error {
- return self.c.WithWaitingStatus(self.c.Tr.UpdatingPatch, func() error {
+ return self.c.WithWaitingStatus(self.c.Tr.UpdatingPatch, func(*gocui.Task) error {
if !self.c.Git().Patch.PatchBuilder.Active() {
if err := self.startPatchBuilder(); err != nil {
return err
diff --git a/pkg/gui/controllers/custom_patch_options_menu_action.go b/pkg/gui/controllers/custom_patch_options_menu_action.go
index a511348bb..b4a35b43a 100644
--- a/pkg/gui/controllers/custom_patch_options_menu_action.go
+++ b/pkg/gui/controllers/custom_patch_options_menu_action.go
@@ -3,6 +3,7 @@ package controllers
import (
"fmt"
+ "github.com/jesseduffield/gocui"
"github.com/jesseduffield/lazygit/pkg/commands/types/enums"
"github.com/jesseduffield/lazygit/pkg/gui/types"
)
@@ -116,7 +117,7 @@ func (self *CustomPatchOptionsMenuAction) handleDeletePatchFromCommit() error {
return err
}
- return self.c.WithWaitingStatus(self.c.Tr.RebasingStatus, func() error {
+ return self.c.WithWaitingStatus(self.c.Tr.RebasingStatus, func(*gocui.Task) error {
commitIndex := self.getPatchCommitIndex()
self.c.LogAction(self.c.Tr.Actions.RemovePatchFromCommit)
err := self.c.Git().Patch.DeletePatchesFromCommit(self.c.Model().Commits, commitIndex)
@@ -133,7 +134,7 @@ func (self *CustomPatchOptionsMenuAction) handleMovePatchToSelectedCommit() erro
return err
}
- return self.c.WithWaitingStatus(self.c.Tr.RebasingStatus, func() error {
+ return self.c.WithWaitingStatus(self.c.Tr.RebasingStatus, func(*gocui.Task) error {
commitIndex := self.getPatchCommitIndex()
self.c.LogAction(self.c.Tr.Actions.MovePatchToSelectedCommit)
err := self.c.Git().Patch.MovePatchToSelectedCommit(self.c.Model().Commits, commitIndex, self.c.Contexts().LocalCommits.GetSelectedLineIdx())
@@ -151,7 +152,7 @@ func (self *CustomPatchOptionsMenuAction) handleMovePatchIntoWorkingTree() error
}
pull := func(stash bool) error {
- return self.c.WithWaitingStatus(self.c.Tr.RebasingStatus, func() error {
+ return self.c.WithWaitingStatus(self.c.Tr.RebasingStatus, func(*gocui.Task) error {
commitIndex := self.getPatchCommitIndex()
self.c.LogAction(self.c.Tr.Actions.MovePatchIntoIndex)
err := self.c.Git().Patch.MovePatchIntoIndex(self.c.Model().Commits, commitIndex, stash)
@@ -181,7 +182,7 @@ func (self *CustomPatchOptionsMenuAction) handlePullPatchIntoNewCommit() error {
return err
}
- return self.c.WithWaitingStatus(self.c.Tr.RebasingStatus, func() error {
+ return self.c.WithWaitingStatus(self.c.Tr.RebasingStatus, func(*gocui.Task) error {
commitIndex := self.getPatchCommitIndex()
self.c.LogAction(self.c.Tr.Actions.MovePatchIntoNewCommit)
err := self.c.Git().Patch.PullPatchIntoNewCommit(self.c.Model().Commits, commitIndex)
diff --git a/pkg/gui/controllers/files_controller.go b/pkg/gui/controllers/files_controller.go
index 61d91ad69..8f43162cf 100644
--- a/pkg/gui/controllers/files_controller.go
+++ b/pkg/gui/controllers/files_controller.go
@@ -4,7 +4,6 @@ import (
"strings"
"github.com/jesseduffield/gocui"
- "github.com/jesseduffield/lazygit/pkg/commands/git_commands"
"github.com/jesseduffield/lazygit/pkg/commands/models"
"github.com/jesseduffield/lazygit/pkg/gui/context"
"github.com/jesseduffield/lazygit/pkg/gui/filetree"
@@ -801,17 +800,17 @@ func (self *FilesController) onClickSecondary(opts gocui.ViewMouseBindingOpts) e
}
func (self *FilesController) fetch() error {
- return self.c.WithLoaderPanel(self.c.Tr.FetchWait, func() error {
- if err := self.fetchAux(); err != nil {
+ return self.c.WithLoaderPanel(self.c.Tr.FetchWait, func(task *gocui.Task) error {
+ if err := self.fetchAux(task); err != nil {
_ = self.c.Error(err)
}
return self.c.Refresh(types.RefreshOptions{Mode: types.ASYNC})
})
}
-func (self *FilesController) fetchAux() (err error) {
+func (self *FilesController) fetchAux(task *gocui.Task) (err error) {
self.c.LogAction("Fetch")
- err = self.c.Git().Sync.Fetch(git_commands.FetchOptions{})
+ err = self.c.Git().Sync.Fetch(task)
if err != nil && strings.Contains(err.Error(), "exit status 128") {
_ = self.c.ErrorMsg(self.c.Tr.PassUnameWrong)
diff --git a/pkg/gui/controllers/files_remove_controller.go b/pkg/gui/controllers/files_remove_controller.go
index f25ae1209..8e1751c64 100644
--- a/pkg/gui/controllers/files_remove_controller.go
+++ b/pkg/gui/controllers/files_remove_controller.go
@@ -1,6 +1,7 @@
package controllers
import (
+ "github.com/jesseduffield/gocui"
"github.com/jesseduffield/lazygit/pkg/commands/models"
"github.com/jesseduffield/lazygit/pkg/gui/context"
"github.com/jesseduffield/lazygit/pkg/gui/filetree"
@@ -145,7 +146,7 @@ func (self *FilesRemoveController) remove(node *filetree.FileNode) error {
}
func (self *FilesRemoveController) ResetSubmodule(submodule *models.SubmoduleConfig) error {
- return self.c.WithWaitingStatus(self.c.Tr.ResettingSubmoduleStatus, func() error {
+ return self.c.WithWaitingStatus(self.c.Tr.ResettingSubmoduleStatus, func(*gocui.Task) error {
self.c.LogAction(self.c.Tr.Actions.ResetSubmodule)
file := self.c.Helpers().WorkingTree.FileForSubmodule(submodule)
diff --git a/pkg/gui/controllers/helpers/app_status_helper.go b/pkg/gui/controllers/helpers/app_status_helper.go
index dcac41e48..e271e1999 100644
--- a/pkg/gui/controllers/helpers/app_status_helper.go
+++ b/pkg/gui/controllers/helpers/app_status_helper.go
@@ -3,6 +3,7 @@ package helpers
import (
"time"
+ "github.com/jesseduffield/gocui"
"github.com/jesseduffield/lazygit/pkg/gui/status"
)
@@ -26,12 +27,12 @@ func (self *AppStatusHelper) Toast(message string) {
}
// withWaitingStatus wraps a function and shows a waiting status while the function is still executing
-func (self *AppStatusHelper) WithWaitingStatus(message string, f func() error) {
- self.c.OnWorker(func() {
+func (self *AppStatusHelper) WithWaitingStatus(message string, f func(*gocui.Task) error) {
+ self.c.OnWorker(func(task *gocui.Task) {
self.statusMgr().WithWaitingStatus(message, func() {
self.renderAppStatus()
- if err := f(); err != nil {
+ if err := f(task); err != nil {
self.c.OnUIThread(func() error {
return self.c.Error(err)
})
@@ -49,7 +50,7 @@ func (self *AppStatusHelper) GetStatusString() string {
}
func (self *AppStatusHelper) renderAppStatus() {
- self.c.OnWorker(func() {
+ self.c.OnWorker(func(_ *gocui.Task) {
ticker := time.NewTicker(time.Millisecond * 50)
defer ticker.Stop()
for range ticker.C {
diff --git a/pkg/gui/controllers/helpers/cherry_pick_helper.go b/pkg/gui/controllers/helpers/cherry_pick_helper.go
index 2c9b7c7c9..9797b3ef3 100644
--- a/pkg/gui/controllers/helpers/cherry_pick_helper.go
+++ b/pkg/gui/controllers/helpers/cherry_pick_helper.go
@@ -1,6 +1,7 @@
package helpers
import (
+ "github.com/jesseduffield/gocui"
"github.com/jesseduffield/lazygit/pkg/commands/models"
"github.com/jesseduffield/lazygit/pkg/gui/modes/cherrypicking"
"github.com/jesseduffield/lazygit/pkg/gui/types"
@@ -75,7 +76,7 @@ func (self *CherryPickHelper) Paste() error {
Title: self.c.Tr.CherryPick,
Prompt: self.c.Tr.SureCherryPick,
HandleConfirm: func() error {
- return self.c.WithWaitingStatus(self.c.Tr.CherryPickingStatus, func() error {
+ return self.c.WithWaitingStatus(self.c.Tr.CherryPickingStatus, func(*gocui.Task) error {
self.c.LogAction(self.c.Tr.Actions.CherryPick)
err := self.c.Git().Rebase.CherryPickCommits(self.getData().CherryPickedCommits)
return self.rebaseHelper.CheckMergeOrRebase(err)
diff --git a/pkg/gui/controllers/helpers/gpg_helper.go b/pkg/gui/controllers/helpers/gpg_helper.go
index 45d67faaf..c31e26c49 100644
--- a/pkg/gui/controllers/helpers/gpg_helper.go
+++ b/pkg/gui/controllers/helpers/gpg_helper.go
@@ -3,6 +3,7 @@ package helpers
import (
"fmt"
+ "github.com/jesseduffield/gocui"
"github.com/jesseduffield/lazygit/pkg/commands/oscommands"
"github.com/jesseduffield/lazygit/pkg/gui/types"
)
@@ -41,7 +42,7 @@ func (self *GpgHelper) WithGpgHandling(cmdObj oscommands.ICmdObj, waitingStatus
}
func (self *GpgHelper) runAndStream(cmdObj oscommands.ICmdObj, waitingStatus string, onSuccess func() error) error {
- return self.c.WithWaitingStatus(waitingStatus, func() error {
+ return self.c.WithWaitingStatus(waitingStatus, func(*gocui.Task) error {
if err := cmdObj.StreamOutput().Run(); err != nil {
_ = self.c.Refresh(types.RefreshOptions{Mode: types.ASYNC})
return self.c.Error(
diff --git a/pkg/gui/controllers/helpers/refresh_helper.go b/pkg/gui/controllers/helpers/refresh_helper.go
index 6c9064519..15fd84375 100644
--- a/pkg/gui/controllers/helpers/refresh_helper.go
+++ b/pkg/gui/controllers/helpers/refresh_helper.go
@@ -7,6 +7,7 @@ import (
"github.com/jesseduffield/generics/set"
"github.com/jesseduffield/generics/slices"
+ "github.com/jesseduffield/gocui"
"github.com/jesseduffield/lazygit/pkg/commands/git_commands"
"github.com/jesseduffield/lazygit/pkg/commands/models"
"github.com/jesseduffield/lazygit/pkg/commands/types/enums"
@@ -86,7 +87,9 @@ func (self *RefreshHelper) Refresh(options types.RefreshOptions) error {
refresh := func(f func()) {
if options.Mode == types.ASYNC {
- self.c.OnWorker(f)
+ self.c.OnWorker(func(t *gocui.Task) {
+ f()
+ })
} else {
f()
}
@@ -198,7 +201,7 @@ func getModeName(mode types.RefreshMode) string {
func (self *RefreshHelper) refreshReflogCommitsConsideringStartup() {
switch self.c.State().GetRepoState().GetStartupStage() {
case types.INITIAL:
- self.c.OnWorker(func() {
+ self.c.OnWorker(func(_ *gocui.Task) {
_ = self.refreshReflogCommits()
self.refreshBranches()
self.c.State().GetRepoState().SetStartupStage(types.COMPLETE)
diff --git a/pkg/gui/controllers/helpers/refs_helper.go b/pkg/gui/controllers/helpers/refs_helper.go
index 18227a35b..c59cd023c 100644
--- a/pkg/gui/controllers/helpers/refs_helper.go
+++ b/pkg/gui/controllers/helpers/refs_helper.go
@@ -5,6 +5,7 @@ import (
"strings"
"github.com/jesseduffield/generics/slices"
+ "github.com/jesseduffield/gocui"
"github.com/jesseduffield/lazygit/pkg/commands/git_commands"
"github.com/jesseduffield/lazygit/pkg/commands/models"
"github.com/jesseduffield/lazygit/pkg/gui/style"
@@ -50,7 +51,7 @@ func (self *RefsHelper) CheckoutRef(ref string, options types.CheckoutRefOptions
self.c.Contexts().LocalCommits.SetLimitCommits(true)
}
- return self.c.WithWaitingStatus(waitingStatus, func() error {
+ return self.c.WithWaitingStatus(waitingStatus, func(*gocui.Task) error {
if err := self.c.Git().Branch.Checkout(ref, cmdOptions); err != nil {
// note, this will only work for english-language git commands. If we force git to use english, and the error isn't this one, then the user will receive an english command they may not understand. I'm not sure what the best solution to this is. Running the command once in english and a second time in the native language is one option
diff --git a/pkg/gui/controllers/helpers/suggestions_helper.go b/pkg/gui/controllers/helpers/suggestions_helper.go
index 70fcf168a..fc3a7ff70 100644
--- a/pkg/gui/controllers/helpers/suggestions_helper.go
+++ b/pkg/gui/controllers/helpers/suggestions_helper.go
@@ -5,6 +5,7 @@ import (
"os"
"github.com/jesseduffield/generics/slices"
+ "github.com/jesseduffield/gocui"
"github.com/jesseduffield/lazygit/pkg/commands/models"
"github.com/jesseduffield/lazygit/pkg/gui/presentation"
"github.com/jesseduffield/lazygit/pkg/gui/types"
@@ -100,7 +101,7 @@ func (self *SuggestionsHelper) GetBranchNameSuggestionsFunc() func(string) []*ty
// Notably, unlike other suggestion functions we're not showing all the options
// if nothing has been typed because there'll be too much to display efficiently
func (self *SuggestionsHelper) GetFilePathSuggestionsFunc() func(string) []*types.Suggestion {
- _ = self.c.WithWaitingStatus(self.c.Tr.LoadingFileSuggestions, func() error {
+ _ = self.c.WithWaitingStatus(self.c.Tr.LoadingFileSuggestions, func(*gocui.Task) error {
trie := patricia.NewTrie()
// load every non-gitignored file in the repo
ignore, err := gitignore.FromGit()
diff --git a/pkg/gui/controllers/helpers/update_helper.go b/pkg/gui/controllers/helpers/update_helper.go
index ea9be8f16..20d55849d 100644
--- a/pkg/gui/controllers/helpers/update_helper.go
+++ b/pkg/gui/controllers/helpers/update_helper.go
@@ -1,6 +1,7 @@
package helpers
import (
+ "github.com/jesseduffield/gocui"
"github.com/jesseduffield/lazygit/pkg/gui/types"
"github.com/jesseduffield/lazygit/pkg/updates"
"github.com/jesseduffield/lazygit/pkg/utils"
@@ -37,7 +38,7 @@ func (self *UpdateHelper) CheckForUpdateInBackground() {
}
func (self *UpdateHelper) CheckForUpdateInForeground() error {
- return self.c.WithWaitingStatus(self.c.Tr.CheckingForUpdates, func() error {
+ return self.c.WithWaitingStatus(self.c.Tr.CheckingForUpdates, func(*gocui.Task) error {
self.updater.CheckForNewUpdate(func(newVersion string, err error) error {
if err != nil {
return self.c.Error(err)
@@ -53,7 +54,7 @@ func (self *UpdateHelper) CheckForUpdateInForeground() error {
}
func (self *UpdateHelper) startUpdating(newVersion string) {
- _ = self.c.WithWaitingStatus(self.c.Tr.UpdateInProgressWaitingStatus, func() error {
+ _ = self.c.WithWaitingStatus(self.c.Tr.UpdateInProgressWaitingStatus, func(*gocui.Task) error {
self.c.State().SetUpdating(true)
err := self.updater.Update(newVersion)
return self.onUpdateFinish(err)
diff --git a/pkg/gui/controllers/local_commits_controller.go b/pkg/gui/controllers/local_commits_controller.go
index 95c791a21..c8d4870f9 100644
--- a/pkg/gui/controllers/local_commits_controller.go
+++ b/pkg/gui/controllers/local_commits_controller.go
@@ -4,6 +4,7 @@ import (
"fmt"
"github.com/fsmiamoto/git-todo-parser/todo"
+ "github.com/jesseduffield/gocui"
"github.com/jesseduffield/lazygit/pkg/commands/models"
"github.com/jesseduffield/lazygit/pkg/commands/types/enums"
"github.com/jesseduffield/lazygit/pkg/gui/context"
@@ -217,7 +218,7 @@ func (self *LocalCommitsController) squashDown(commit *models.Commit) error {
Title: self.c.Tr.Squash,
Prompt: self.c.Tr.SureSquashThisCommit,
HandleConfirm: func() error {
- return self.c.WithWaitingStatus(self.c.Tr.SquashingStatus, func() error {
+ return self.c.WithWaitingStatus(self.c.Tr.SquashingStatus, func(*gocui.Task) error {
self.c.LogAction(self.c.Tr.Actions.SquashCommitDown)
return self.interactiveRebase(todo.Squash)
})
@@ -242,7 +243,7 @@ func (self *LocalCommitsController) fixup(commit *models.Commit) error {
Title: self.c.Tr.Fixup,
Prompt: self.c.Tr.SureFixupThisCommit,
HandleConfirm: func() error {
- return self.c.WithWaitingStatus(self.c.Tr.FixingStatus, func() error {
+ return self.c.WithWaitingStatus(self.c.Tr.FixingStatus, func(*gocui.Task) error {
self.c.LogAction(self.c.Tr.Actions.FixupCommit)
return self.interactiveRebase(todo.Fixup)
})
@@ -338,7 +339,7 @@ func (self *LocalCommitsController) drop(commit *models.Commit) error {
Title: self.c.Tr.DeleteCommitTitle,
Prompt: self.c.Tr.DeleteCommitPrompt,
HandleConfirm: func() error {
- return self.c.WithWaitingStatus(self.c.Tr.DeletingStatus, func() error {
+ return self.c.WithWaitingStatus(self.c.Tr.DeletingStatus, func(*gocui.Task) error {
self.c.LogAction(self.c.Tr.Actions.DropCommit)
return self.interactiveRebase(todo.Drop)
})
@@ -355,7 +356,7 @@ func (self *LocalCommitsController) edit(commit *models.Commit) error {
return nil
}
- return self.c.WithWaitingStatus(self.c.Tr.RebasingStatus, func() error {
+ return self.c.WithWaitingStatus(self.c.Tr.RebasingStatus, func(*gocui.Task) error {
self.c.LogAction(self.c.Tr.Actions.EditCommit)
err := self.c.Git().Rebase.EditRebase(commit.Sha)
return self.c.Helpers().MergeAndRebase.CheckMergeOrRebase(err)
@@ -460,7 +461,7 @@ func (self *LocalCommitsController) moveDown(commit *models.Commit) error {
return self.c.ErrorMsg(self.c.Tr.AlreadyRebasing)
}
- return self.c.WithWaitingStatus(self.c.Tr.MovingStatus, func() error {
+ return self.c.WithWaitingStatus(self.c.Tr.MovingStatus, func(*gocui.Task) error {
self.c.LogAction(self.c.Tr.Actions.MoveCommitDown)
err := self.c.Git().Rebase.MoveCommitDown(self.c.Model().Commits, index)
if err == nil {
@@ -498,7 +499,7 @@ func (self *LocalCommitsController) moveUp(commit *models.Commit) error {
return self.c.ErrorMsg(self.c.Tr.AlreadyRebasing)
}
- return self.c.WithWaitingStatus(self.c.Tr.MovingStatus, func() error {
+ return self.c.WithWaitingStatus(self.c.Tr.MovingStatus, func(*gocui.Task) error {
self.c.LogAction(self.c.Tr.Actions.MoveCommitUp)
err := self.c.Git().Rebase.MoveCommitUp(self.c.Model().Commits, index)
if err == nil {
@@ -524,7 +525,7 @@ func (self *LocalCommitsController) amendTo(commit *models.Commit) error {
Title: self.c.Tr.AmendCommitTitle,
Prompt: self.c.Tr.AmendCommitPrompt,
HandleConfirm: func() error {
- return self.c.WithWaitingStatus(self.c.Tr.AmendingStatus, func() error {
+ return self.c.WithWaitingStatus(self.c.Tr.AmendingStatus, func(*gocui.Task) error {
self.c.LogAction(self.c.Tr.Actions.AmendCommit)
err := self.c.Git().Rebase.AmendTo(self.c.Model().Commits, self.context().GetView().SelectedLineIdx())
return self.c.Helpers().MergeAndRebase.CheckMergeOrRebase(err)
@@ -558,7 +559,7 @@ func (self *LocalCommitsController) amendAttribute(commit *models.Commit) error
}
func (self *LocalCommitsController) resetAuthor() error {
- return self.c.WithWaitingStatus(self.c.Tr.AmendingStatus, func() error {
+ return self.c.WithWaitingStatus(self.c.Tr.AmendingStatus, func(*gocui.Task) error {
self.c.LogAction(self.c.Tr.Actions.ResetCommitAuthor)
if err := self.c.Git().Rebase.ResetCommitAuthor(self.c.Model().Commits, self.context().GetSelectedLineIdx()); err != nil {
return self.c.Error(err)
@@ -573,7 +574,7 @@ func (self *LocalCommitsController) setAuthor() error {
Title: self.c.Tr.SetAuthorPromptTitle,
FindSuggestionsFunc: self.c.Helpers().Suggestions.GetAuthorsSuggestionsFunc(),
HandleConfirm: func(value string) error {
- return self.c.WithWaitingStatus(self.c.Tr.AmendingStatus, func() error {
+ return self.c.WithWaitingStatus(self.c.Tr.AmendingStatus, func(*gocui.Task) error {
self.c.LogAction(self.c.Tr.Actions.SetCommitAuthor)
if err := self.c.Git().Rebase.SetCommitAuthor(self.c.Model().Commits, self.context().GetSelectedLineIdx(), value); err != nil {
return self.c.Error(err)
@@ -671,7 +672,7 @@ func (self *LocalCommitsController) squashAllAboveFixupCommits(commit *models.Co
Title: self.c.Tr.SquashAboveCommits,
Prompt: prompt,
HandleConfirm: func() error {
- return self.c.WithWaitingStatus(self.c.Tr.SquashingStatus, func() error {
+ return self.c.WithWaitingStatus(self.c.Tr.SquashingStatus, func(*gocui.Task) error {
self.c.LogAction(self.c.Tr.Actions.SquashAllAboveFixupCommits)
err := self.c.Git().Rebase.SquashAllAboveFixupCommits(commit)
return self.c.Helpers().MergeAndRebase.CheckMergeOrRebase(err)
@@ -723,7 +724,7 @@ func (self *LocalCommitsController) handleOpenLogMenu() error {
self.context().SetLimitCommits(false)
}
- return self.c.WithWaitingStatus(self.c.Tr.LoadingCommits, func() error {
+ return self.c.WithWaitingStatus(self.c.Tr.LoadingCommits, func(*gocui.Task) error {
return self.c.Refresh(
types.RefreshOptions{Mode: types.SYNC, Scope: []types.RefreshableView{types.COMMITS}},
)
@@ -766,7 +767,7 @@ func (self *LocalCommitsController) handleOpenLogMenu() error {
onPress := func(value string) func() error {
return func() error {
self.c.UserConfig.Git.Log.Order = value
- return self.c.WithWaitingStatus(self.c.Tr.LoadingCommits, func() error {
+ return self.c.WithWaitingStatus(self.c.Tr.LoadingCommits, func(*gocui.Task) error {
return self.c.Refresh(
types.RefreshOptions{
Mode: types.SYNC,
@@ -816,7 +817,7 @@ func (self *LocalCommitsController) GetOnFocus() func(types.OnFocusOpts) error {
context := self.context()
if context.GetSelectedLineIdx() > COMMIT_THRESHOLD && context.GetLimitCommits() {
context.SetLimitCommits(false)
- self.c.OnWorker(func() {
+ self.c.OnWorker(func(_ *gocui.Task) {
if err := self.c.Refresh(types.RefreshOptions{Scope: []types.RefreshableView{types.COMMITS}}); err != nil {
_ = self.c.Error(err)
}
diff --git a/pkg/gui/controllers/remote_branches_controller.go b/pkg/gui/controllers/remote_branches_controller.go
index b26230d90..80c964816 100644
--- a/pkg/gui/controllers/remote_branches_controller.go
+++ b/pkg/gui/controllers/remote_branches_controller.go
@@ -4,6 +4,7 @@ import (
"fmt"
"strings"
+ "github.com/jesseduffield/gocui"
"github.com/jesseduffield/lazygit/pkg/commands/models"
"github.com/jesseduffield/lazygit/pkg/gui/context"
"github.com/jesseduffield/lazygit/pkg/gui/types"
@@ -117,9 +118,9 @@ func (self *RemoteBranchesController) delete(selectedBranch *models.RemoteBranch
Title: self.c.Tr.DeleteRemoteBranch,
Prompt: message,
HandleConfirm: func() error {
- return self.c.WithWaitingStatus(self.c.Tr.DeletingStatus, func() error {
+ return self.c.WithWaitingStatus(self.c.Tr.DeletingStatus, func(task *gocui.Task) error {
self.c.LogAction(self.c.Tr.Actions.DeleteRemoteBranch)
- err := self.c.Git().Remote.DeleteRemoteBranch(selectedBranch.RemoteName, selectedBranch.Name)
+ err := self.c.Git().Remote.DeleteRemoteBranch(task, selectedBranch.RemoteName, selectedBranch.Name)
if err != nil {
_ = self.c.Error(err)
}
diff --git a/pkg/gui/controllers/remotes_controller.go b/pkg/gui/controllers/remotes_controller.go
index b6d9a963b..dba08380d 100644
--- a/pkg/gui/controllers/remotes_controller.go
+++ b/pkg/gui/controllers/remotes_controller.go
@@ -4,6 +4,7 @@ import (
"fmt"
"strings"
+ "github.com/jesseduffield/gocui"
"github.com/jesseduffield/lazygit/pkg/commands/models"
"github.com/jesseduffield/lazygit/pkg/gui/context"
"github.com/jesseduffield/lazygit/pkg/gui/style"
@@ -197,8 +198,8 @@ func (self *RemotesController) edit(remote *models.Remote) error {
}
func (self *RemotesController) fetch(remote *models.Remote) error {
- return self.c.WithWaitingStatus(self.c.Tr.FetchingRemoteStatus, func() error {
- err := self.c.Git().Sync.FetchRemote(remote.Name)
+ return self.c.WithWaitingStatus(self.c.Tr.FetchingRemoteStatus, func(task *gocui.Task) error {
+ err := self.c.Git().Sync.FetchRemote(task, remote.Name)
if err != nil {
_ = self.c.Error(err)
}
diff --git a/pkg/gui/controllers/sub_commits_controller.go b/pkg/gui/controllers/sub_commits_controller.go
index f6c519406..b56ff7bb4 100644
--- a/pkg/gui/controllers/sub_commits_controller.go
+++ b/pkg/gui/controllers/sub_commits_controller.go
@@ -1,6 +1,7 @@
package controllers
import (
+ "github.com/jesseduffield/gocui"
"github.com/jesseduffield/lazygit/pkg/gui/context"
"github.com/jesseduffield/lazygit/pkg/gui/types"
)
@@ -59,7 +60,7 @@ func (self *SubCommitsController) GetOnFocus() func(types.OnFocusOpts) error {
context := self.context()
if context.GetSelectedLineIdx() > COMMIT_THRESHOLD && context.GetLimitCommits() {
context.SetLimitCommits(false)
- self.c.OnWorker(func() {
+ self.c.OnWorker(func(_ *gocui.Task) {
if err := self.c.Refresh(types.RefreshOptions{Scope: []types.RefreshableView{types.SUB_COMMITS}}); err != nil {
_ = self.c.Error(err)
}
diff --git a/pkg/gui/controllers/submodules_controller.go b/pkg/gui/controllers/submodules_controller.go
index 80ac54cd7..43d321df6 100644
--- a/pkg/gui/controllers/submodules_controller.go
+++ b/pkg/gui/controllers/submodules_controller.go
@@ -5,6 +5,7 @@ import (
"path/filepath"
"strings"
+ "github.com/jesseduffield/gocui"
"github.com/jesseduffield/lazygit/pkg/commands/models"
"github.com/jesseduffield/lazygit/pkg/gui/context"
"github.com/jesseduffield/lazygit/pkg/gui/style"
@@ -130,7 +131,7 @@ func (self *SubmodulesController) add() error {
Title: self.c.Tr.NewSubmodulePath,
InitialContent: submoduleName,
HandleConfirm: func(submodulePath string) error {
- return self.c.WithWaitingStatus(self.c.Tr.AddingSubmoduleStatus, func() error {
+ return self.c.WithWaitingStatus(self.c.Tr.AddingSubmoduleStatus, func(*gocui.Task) error {
self.c.LogAction(self.c.Tr.Actions.AddSubmodule)
err := self.c.Git().Submodule.Add(submoduleName, submodulePath, submoduleUrl)
if err != nil {
@@ -152,7 +153,7 @@ func (self *SubmodulesController) editURL(submodule *models.SubmoduleConfig) err
Title: fmt.Sprintf(self.c.Tr.UpdateSubmoduleUrl, submodule.Name),
InitialContent: submodule.Url,
HandleConfirm: func(newUrl string) error {
- return self.c.WithWaitingStatus(self.c.Tr.UpdatingSubmoduleUrlStatus, func() error {
+ return self.c.WithWaitingStatus(self.c.Tr.UpdatingSubmoduleUrlStatus, func(*gocui.Task) error {
self.c.LogAction(self.c.Tr.Actions.UpdateSubmoduleUrl)
err := self.c.Git().Submodule.UpdateUrl(submodule.Name, submodule.Path, newUrl)
if err != nil {
@@ -166,7 +167,7 @@ func (self *SubmodulesController) editURL(submodule *models.SubmoduleConfig) err
}
func (self *SubmodulesController) init(submodule *models.SubmoduleConfig) error {
- return self.c.WithWaitingStatus(self.c.Tr.InitializingSubmoduleStatus, func() error {
+ return self.c.WithWaitingStatus(self.c.Tr.InitializingSubmoduleStatus, func(*gocui.Task) error {
self.c.LogAction(self.c.Tr.Actions.InitialiseSubmodule)
err := self.c.Git().Submodule.Init(submodule.Path)
if err != nil {
@@ -184,7 +185,7 @@ func (self *SubmodulesController) openBulkActionsMenu() error {
{
LabelColumns: []string{self.c.Tr.BulkInitSubmodules, style.FgGreen.Sprint(self.c.Git().Submodule.BulkInitCmdObj().ToString())},
OnPress: func() error {
- return self.c.WithWaitingStatus(self.c.Tr.RunningCommand, func() error {
+ return self.c.WithWaitingStatus(self.c.Tr.RunningCommand, func(*gocui.Task) error {
self.c.LogAction(self.c.Tr.Actions.BulkInitialiseSubmodules)
err := self.c.Git().Submodule.BulkInitCmdObj().Run()
if err != nil {
@@ -199,7 +200,7 @@ func (self *SubmodulesController) openBulkActionsMenu() error {
{
LabelColumns: []string{self.c.Tr.BulkUpdateSubmodules, style.FgYellow.Sprint(self.c.Git().Submodule.BulkUpdateCmdObj().ToString())},
OnPress: func() error {
- return self.c.WithWaitingStatus(self.c.Tr.RunningCommand, func() error {
+ return self.c.WithWaitingStatus(self.c.Tr.RunningCommand, func(*gocui.Task) error {
self.c.LogAction(self.c.Tr.Actions.BulkUpdateSubmodules)
if err := self.c.Git().Submodule.BulkUpdateCmdObj().Run(); err != nil {
return self.c.Error(err)
@@ -213,7 +214,7 @@ func (s