mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-04-21 12:16:54 +02:00
reorder
This commit is contained in:
parent
43d3f2bcb6
commit
cf74c2cf96
@ -107,6 +107,32 @@ outer:
|
|||||||
return branches, nil
|
return branches, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (self *BranchLoader) obtainBranches() []*models.Branch {
|
||||||
|
output, err := self.getRawBranches()
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
trimmedOutput := strings.TrimSpace(output)
|
||||||
|
outputLines := strings.Split(trimmedOutput, "\n")
|
||||||
|
|
||||||
|
return slices.FilterMap(outputLines, func(line string) (*models.Branch, bool) {
|
||||||
|
if line == "" {
|
||||||
|
return nil, false
|
||||||
|
}
|
||||||
|
|
||||||
|
split := strings.Split(line, SEPARATION_CHAR)
|
||||||
|
if len(split) != 4 {
|
||||||
|
// Ignore line if it isn't separated into 4 parts
|
||||||
|
// This is probably a warning message, for more info see:
|
||||||
|
// https://github.com/jesseduffield/lazygit/issues/1385#issuecomment-885580439
|
||||||
|
return nil, false
|
||||||
|
}
|
||||||
|
|
||||||
|
return obtainBranch(split), true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// Obtain branch information from parsed line output of getRawBranches()
|
// Obtain branch information from parsed line output of getRawBranches()
|
||||||
// split contains the '|' separated tokens in the line of output
|
// split contains the '|' separated tokens in the line of output
|
||||||
func obtainBranch(split []string) *models.Branch {
|
func obtainBranch(split []string) *models.Branch {
|
||||||
@ -150,32 +176,6 @@ func obtainBranch(split []string) *models.Branch {
|
|||||||
return branch
|
return branch
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *BranchLoader) obtainBranches() []*models.Branch {
|
|
||||||
output, err := self.getRawBranches()
|
|
||||||
if err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
trimmedOutput := strings.TrimSpace(output)
|
|
||||||
outputLines := strings.Split(trimmedOutput, "\n")
|
|
||||||
|
|
||||||
return slices.FilterMap(outputLines, func(line string) (*models.Branch, bool) {
|
|
||||||
if line == "" {
|
|
||||||
return nil, false
|
|
||||||
}
|
|
||||||
|
|
||||||
split := strings.Split(line, SEPARATION_CHAR)
|
|
||||||
if len(split) != 4 {
|
|
||||||
// Ignore line if it isn't separated into 4 parts
|
|
||||||
// This is probably a warning message, for more info see:
|
|
||||||
// https://github.com/jesseduffield/lazygit/issues/1385#issuecomment-885580439
|
|
||||||
return nil, false
|
|
||||||
}
|
|
||||||
|
|
||||||
return obtainBranch(split), true
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: only look at the new reflog commits, and otherwise store the recencies in
|
// TODO: only look at the new reflog commits, and otherwise store the recencies in
|
||||||
// int form against the branch to recalculate the time ago
|
// int form against the branch to recalculate the time ago
|
||||||
func (self *BranchLoader) obtainReflogBranches(reflogCommits []*models.Commit) []*models.Branch {
|
func (self *BranchLoader) obtainReflogBranches(reflogCommits []*models.Commit) []*models.Branch {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user