Skip to content

Order the refs view by current branch, master/main and commit date - #1455

Closed
tmalloy wants to merge 1 commit into
jonas:masterfrom
tmalloy:refs-view-sort-order
Closed

tmalloy wants to merge 1 commit into
jonas:masterfrom
tmalloy:refs-view-sort-order

Conversation

@tmalloy

@tmalloy tmalloy commented Oct 2, 2026

Copy link
Copy Markdown

When sorting by the ref column, which is the default, list the current branch first, then master and main, then the other local branches with the most recently committed first, then the remote branches by name. Tags and other refs keep their previous order after the remotes.

The commit dates are loaded after the lines have been added, so re-sort once loading ends, unless it was stopped. Keep the cursor on the selected ref when re-sorting and when reloading the view.

To support this, add an optional compare hook to the view ops and make timecmp() safe for dates that are far apart.

When sorting by the ref column, which is the default, list the current
branch first, then master and main, then the other local branches with
the most recently committed first, then the remote branches by name.
Tags and other refs keep their previous order after the remotes.

The commit dates are loaded after the lines have been added, so re-sort
once loading ends, unless it was stopped. Keep the cursor on the
selected ref when re-sorting and when reloading the view.

To support this, add an optional compare hook to the view ops and make
timecmp() safe for dates that are far apart.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@tmalloy tmalloy closed this Oct 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant