You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Previously, I thought sorting by name was the only reasonable way to sort branch names.
Recently, I've had the need to sort branches by the date of their latest commit.
This makes me think it may be better not to sort branches and let the user do it based on their needs. We could provide helpers for common sort types:
// Sort by branch name.sort.Sort(vcs.ByName(branches))
// Sort by author date, most recent first.sort.Sort(sort.Reverse(vcs.ByAuthorDate(branches)))
On the other hand, sorting branches by name may be a decent and inexpensive "default", so perhaps it's fine to always do that (the user can sort again differently if they need).
Minor issue. I've noticed that some implementations of
Branches
sort the branches before returning:While others do not. The interface does not specify any sorting behavior.
We should improve docs to specify some behavior, and make the output consistent (if it's not).
The text was updated successfully, but these errors were encountered: