This commit is contained in:
Stefan Haller 2026-08-30 16:51:37 -07:00 committed by GitHub
commit 53ee36fd29
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -71,7 +71,10 @@ func (self *BranchLoader) Load(reflogCommits []*models.Commit,
onWorker func(func() error),
renderFunc func(),
) ([]*models.Branch, error) {
branches := self.obtainBranches()
branches, err := self.obtainBranches()
if err != nil {
return nil, err
}
if self.UserConfig().Git.LocalBranchSortOrder == "recency" {
reflogBranches := self.obtainReflogBranches(reflogCommits)
@ -362,16 +365,16 @@ func (self *BranchLoader) GetBaseBranch(branch *models.Branch, mainBranches *Mai
return split[0], nil
}
func (self *BranchLoader) obtainBranches() []*models.Branch {
func (self *BranchLoader) obtainBranches() ([]*models.Branch, error) {
output, err := self.getRawBranches()
if err != nil {
panic(err)
return nil, err
}
trimmedOutput := strings.TrimSpace(output)
outputLines := strings.Split(trimmedOutput, "\n")
return lo.FilterMap(outputLines, func(line string, _ int) (*models.Branch, bool) {
branches := lo.FilterMap(outputLines, func(line string, _ int) (*models.Branch, bool) {
if line == "" {
return nil, false
}
@ -387,6 +390,7 @@ func (self *BranchLoader) obtainBranches() []*models.Branch {
storeCommitDateAsRecency := self.UserConfig().Git.LocalBranchSortOrder != "recency"
return obtainBranch(split, storeCommitDateAsRecency), true
})
return branches, nil
}
func (self *BranchLoader) getRawBranches() (string, error) {