diff --git a/pkg/commands/git_commands/branch_loader.go b/pkg/commands/git_commands/branch_loader.go index 606f5c30d..798a2ebef 100644 --- a/pkg/commands/git_commands/branch_loader.go +++ b/pkg/commands/git_commands/branch_loader.go @@ -72,7 +72,7 @@ func (self *BranchLoader) Load(reflogCommits []*models.Commit, onWorker func(func() error), renderFunc func(), ) ([]*models.Branch, error) { - branches := self.obtainBranches(self.version.IsAtLeast(2, 22, 0)) + branches := self.obtainBranches() if self.AppState.LocalBranchSortOrder == "recency" { reflogBranches := self.obtainReflogBranches(reflogCommits) @@ -232,7 +232,7 @@ func (self *BranchLoader) GetBaseBranch(branch *models.Branch, mainBranches *Mai return split[0], nil } -func (self *BranchLoader) obtainBranches(canUsePushTrack bool) []*models.Branch { +func (self *BranchLoader) obtainBranches() []*models.Branch { output, err := self.getRawBranches() if err != nil { panic(err) @@ -255,7 +255,7 @@ func (self *BranchLoader) obtainBranches(canUsePushTrack bool) []*models.Branch } storeCommitDateAsRecency := self.AppState.LocalBranchSortOrder != "recency" - return obtainBranch(split, storeCommitDateAsRecency, canUsePushTrack), true + return obtainBranch(split, storeCommitDateAsRecency), true }) } @@ -298,7 +298,7 @@ var branchFields = []string{ } // Obtain branch information from parsed line output of getRawBranches() -func obtainBranch(split []string, storeCommitDateAsRecency bool, canUsePushTrack bool) *models.Branch { +func obtainBranch(split []string, storeCommitDateAsRecency bool) *models.Branch { headMarker := split[0] fullName := split[1] upstreamName := split[2] @@ -310,12 +310,7 @@ func obtainBranch(split []string, storeCommitDateAsRecency bool, canUsePushTrack name := strings.TrimPrefix(fullName, "heads/") aheadForPull, behindForPull, gone := parseUpstreamInfo(upstreamName, track) - var aheadForPush, behindForPush string - if canUsePushTrack { - aheadForPush, behindForPush, _ = parseUpstreamInfo(upstreamName, pushTrack) - } else { - aheadForPush, behindForPush = aheadForPull, behindForPull - } + aheadForPush, behindForPush, _ := parseUpstreamInfo(upstreamName, pushTrack) recency := "" if storeCommitDateAsRecency { diff --git a/pkg/commands/git_commands/branch_loader_test.go b/pkg/commands/git_commands/branch_loader_test.go index 2236374e5..27a747879 100644 --- a/pkg/commands/git_commands/branch_loader_test.go +++ b/pkg/commands/git_commands/branch_loader_test.go @@ -119,7 +119,7 @@ func TestObtainBranch(t *testing.T) { for _, s := range scenarios { t.Run(s.testName, func(t *testing.T) { - branch := obtainBranch(s.input, s.storeCommitDateAsRecency, true) + branch := obtainBranch(s.input, s.storeCommitDateAsRecency) assert.EqualValues(t, s.expectedBranch, branch) }) }