diff options
author | Karl Heitmann <khf1988@gmail.com> | 2023-07-28 21:27:15 -0400 |
---|---|---|
committer | Karl Heitmann <khf1988@gmail.com> | 2023-07-31 19:46:59 -0400 |
commit | c7e6a73512755cc7e69c442f2def2c8e366cf864 (patch) | |
tree | 0fb1b1e08efe5f709e1037cf486b35b10c6af73b /pkg | |
parent | 6984a4f4d41d003a3443abe357d75caf2af6b34c (diff) |
Wraps rebase func with WithWaitingStatus to show loader when rebasing
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/gui/controllers/helpers/merge_and_rebase_helper.go | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/pkg/gui/controllers/helpers/merge_and_rebase_helper.go b/pkg/gui/controllers/helpers/merge_and_rebase_helper.go index 03c3abb4b..db3ffa9ae 100644 --- a/pkg/gui/controllers/helpers/merge_and_rebase_helper.go +++ b/pkg/gui/controllers/helpers/merge_and_rebase_helper.go @@ -4,6 +4,7 @@ import ( "fmt" "strings" + "github.com/jesseduffield/gocui" "github.com/jesseduffield/lazygit/pkg/commands/git_commands" "github.com/jesseduffield/lazygit/pkg/commands/types/enums" "github.com/jesseduffield/lazygit/pkg/gui/types" @@ -224,18 +225,20 @@ func (self *MergeAndRebaseHelper) RebaseOntoRef(ref string) error { Key: 's', OnPress: func() error { self.c.LogAction(self.c.Tr.Actions.RebaseBranch) - baseCommit := self.c.Modes().MarkedBaseCommit.GetSha() - var err error - if baseCommit != "" { - err = self.c.Git().Rebase.RebaseBranchFromBaseCommit(ref, baseCommit) - } else { - err = self.c.Git().Rebase.RebaseBranch(ref) - } - err = self.CheckMergeOrRebase(err) - if err == nil { - self.c.Modes().MarkedBaseCommit.Reset() - } - return err + return self.c.WithWaitingStatus(self.c.Tr.RebasingStatus, func(task gocui.Task) error { + baseCommit := self.c.Modes().MarkedBaseCommit.GetSha() + var err error + if baseCommit != "" { + err = self.c.Git().Rebase.RebaseBranchFromBaseCommit(ref, baseCommit) + } else { + err = self.c.Git().Rebase.RebaseBranch(ref) + } + err = self.CheckMergeOrRebase(err) + if err == nil { + self.c.Modes().MarkedBaseCommit.Reset() + } + return err + }) }, }, { |