summaryrefslogtreecommitdiffstats
path: root/pkg/gui/commits_panel.go
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2020-08-27 20:50:30 +1000
committerJesse Duffield <jessedduffield@gmail.com>2020-08-27 21:51:07 +1000
commit40bec49de8428be4e771f2ded1e8ffecbd0c4fd5 (patch)
treef97d7d748bb2441d867e5b81c3a9a9323dde0aa6 /pkg/gui/commits_panel.go
parentf99d5f74d49109c19f7701005e636a38c9a70fdb (diff)
more efficient refreshing of rebase commits
Diffstat (limited to 'pkg/gui/commits_panel.go')
-rw-r--r--pkg/gui/commits_panel.go25
1 files changed, 21 insertions, 4 deletions
diff --git a/pkg/gui/commits_panel.go b/pkg/gui/commits_panel.go
index 200fea7af..950149c6e 100644
--- a/pkg/gui/commits_panel.go
+++ b/pkg/gui/commits_panel.go
@@ -97,7 +97,10 @@ func (gui *Gui) refreshCommits() error {
}
func (gui *Gui) refreshCommitsWithLimit() error {
- builder := commands.NewCommitListBuilder(gui.Log, gui.GitCommand, gui.OSCommand, gui.Tr, gui.State.Modes.CherryPicking.CherryPickedCommits)
+ gui.State.BranchCommitsMutex.Lock()
+ defer gui.State.BranchCommitsMutex.Unlock()
+
+ builder := commands.NewCommitListBuilder(gui.Log, gui.GitCommand, gui.OSCommand, gui.Tr)
commits, err := builder.GetCommits(
commands.GetCommitsOptions{
@@ -115,6 +118,21 @@ func (gui *Gui) refreshCommitsWithLimit() error {
return gui.postRefreshUpdate(gui.Contexts.BranchCommits.Context)
}
+func (gui *Gui) refreshRebaseCommits() error {
+ gui.State.BranchCommitsMutex.Lock()
+ defer gui.State.BranchCommitsMutex.Unlock()
+
+ builder := commands.NewCommitListBuilder(gui.Log, gui.GitCommand, gui.OSCommand, gui.Tr)
+
+ updatedCommits, err := builder.MergeRebasingCommits(gui.State.Commits)
+ if err != nil {
+ return err
+ }
+ gui.State.Commits = updatedCommits
+
+ return gui.postRefreshUpdate(gui.Contexts.BranchCommits.Context)
+}
+
// specific functions
func (gui *Gui) handleCommitSquashDown(g *gocui.Gui, v *gocui.View) error {
@@ -256,9 +274,8 @@ func (gui *Gui) handleMidRebaseCommand(action string) (bool, error) {
if err := gui.GitCommand.EditRebaseTodo(gui.State.Panels.Commits.SelectedLineIdx, action); err != nil {
return false, gui.surfaceError(err)
}
- // TODO: consider doing this in a way that is less expensive. We don't actually
- // need to reload all the commits, just the TODO commits.
- return true, gui.refreshSidePanels(refreshOptions{scope: []int{COMMITS}})
+
+ return true, gui.refreshRebaseCommits()
}
func (gui *Gui) handleCommitDelete(g *gocui.Gui, v *gocui.View) error {