From c6113f6a281de471525e0695687689023a1fd284 Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Fri, 31 May 2024 10:48:13 +0200 Subject: [PATCH] fixup! Show divergence from base branch in branches list --- pkg/commands/git_commands/branch_loader.go | 12 ++++++------ pkg/gui/controllers/helpers/refresh_helper.go | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/pkg/commands/git_commands/branch_loader.go b/pkg/commands/git_commands/branch_loader.go index 62c4c1cadb7..929d5964d3f 100644 --- a/pkg/commands/git_commands/branch_loader.go +++ b/pkg/commands/git_commands/branch_loader.go @@ -66,7 +66,7 @@ func NewBranchLoader( // Load the list of branches for the current repo func (self *BranchLoader) Load(reflogCommits []*models.Commit, - existingMainBranches *ExistingMainBranches, + mainBranches *MainBranches, oldBranches []*models.Branch, loadBehindCounts bool, onWorker func(func() error), @@ -142,7 +142,7 @@ func (self *BranchLoader) Load(reflogCommits []*models.Commit, if loadBehindCounts && self.UserConfig.Gui.ShowDivergenceFromBaseBranch != "none" { onWorker(func() error { - return self.GetBehindBaseBranchValuesForAllBranches(branches, existingMainBranches, renderFunc) + return self.GetBehindBaseBranchValuesForAllBranches(branches, mainBranches, renderFunc) }) } @@ -151,11 +151,11 @@ func (self *BranchLoader) Load(reflogCommits []*models.Commit, func (self *BranchLoader) GetBehindBaseBranchValuesForAllBranches( branches []*models.Branch, - existingMainBranches *ExistingMainBranches, + mainBranches *MainBranches, renderFunc func(), ) error { - mainBranches := existingMainBranches.Get() - if len(mainBranches) == 0 { + mainBranchRefs := mainBranches.Get() + if len(mainBranchRefs) == 0 { return nil } @@ -164,7 +164,7 @@ func (self *BranchLoader) GetBehindBaseBranchValuesForAllBranches( for _, branch := range branches { errg.Go(func() error { - baseBranch, err := self.GetBaseBranch(branch, existingMainBranches) + baseBranch, err := self.GetBaseBranch(branch, mainBranches) if err != nil { return err } diff --git a/pkg/gui/controllers/helpers/refresh_helper.go b/pkg/gui/controllers/helpers/refresh_helper.go index eaa77109299..8b4192272dc 100644 --- a/pkg/gui/controllers/helpers/refresh_helper.go +++ b/pkg/gui/controllers/helpers/refresh_helper.go @@ -459,7 +459,7 @@ func (self *RefreshHelper) refreshBranches(refreshWorktrees bool, keepBranchSele branches, err := self.c.Git().Loaders.BranchLoader.Load( reflogCommits, - self.c.Model().ExistingMainBranches, + self.c.Model().MainBranches, self.c.Model().Branches, loadBehindCounts, func(f func() error) {