mirror of
https://github.com/grdl/git-get.git
synced 2026-02-04 15:39:46 +00:00
Update branch name sorting to keep master always on top
This commit is contained in:
@@ -136,8 +136,12 @@ func (r *Repo) loadBranchesStatus() error {
|
||||
return errors.Wrap(err, "Failed iterating over branches")
|
||||
}
|
||||
|
||||
// Sort branches by name. It's useful to have them sorted for printing and testing.
|
||||
// Sort branches by name (but with "master" always at the top). It's useful to have them sorted for printing and testing.
|
||||
sort.Slice(r.Status.Branches, func(i, j int) bool {
|
||||
if r.Status.Branches[i].Name == "master" {
|
||||
return true
|
||||
}
|
||||
|
||||
return strings.Compare(r.Status.Branches[i].Name, r.Status.Branches[j].Name) < 0
|
||||
})
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user