Skip to content

Commit

Permalink
Sorts remotes with default first
Browse files Browse the repository at this point in the history
  • Loading branch information
eamodio committed Jan 23, 2019
1 parent 86c4d32 commit c4d418c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p

## [Unreleased]

### Changed

- Changes the sorting of remotes in the _Repositories_ view to sort the default remote first

### Fixed

- Fixes [#591](https://github.com/eamodio/vscode-gitlens/issues/591) - GitLens Error: Unable to open
Expand Down
6 changes: 5 additions & 1 deletion src/views/nodes/remotesNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ export class RemotesNode extends ViewNode<RepositoriesView> {
return [new MessageNode(this.view, this, 'No remotes could be found')];
}

remotes.sort((a, b) => a.name.localeCompare(b.name, undefined, { numeric: true, sensitivity: 'base' }));
remotes.sort(
(a, b) =>
(a.default ? -1 : 1) - (b.default ? -1 : 1) ||
a.name.localeCompare(b.name, undefined, { numeric: true, sensitivity: 'base' })
);
return [...Iterables.map(remotes, r => new RemoteNode(this.uri, this.view, this, r, this.repo))];
}

Expand Down

0 comments on commit c4d418c

Please sign in to comment.