Skip to content

Commit 5dc2d0a

Browse files
committed
Fixes branch & tag sort honoring setting
1 parent 36913a3 commit 5dc2d0a

File tree

7 files changed

+12
-41
lines changed

7 files changed

+12
-41
lines changed

src/commands/openBranchOnRemote.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import {
1010
getRepoPathOrActiveOrPrompt,
1111
isCommandContextViewNodeHasBranch,
1212
} from './common';
13-
import { BranchSorting } from '../configuration';
1413
import { RemoteResourceType } from '../git/git';
1514
import { GitUri } from '../git/gitUri';
1615
import { Logger } from '../logger';
@@ -70,9 +69,7 @@ export class OpenBranchOnRemoteCommand extends ActiveEditorCommand {
7069
// checkmarks: false,
7170
filter: { branches: b => b.tracking != null },
7271
include: ReferencesQuickPickIncludes.Branches,
73-
sort: {
74-
branches: { current: true, orderBy: BranchSorting.DateDesc },
75-
},
72+
sort: { branches: { current: true }, tags: {} },
7673
},
7774
);
7875
if (pick == null || pick instanceof CommandQuickPickItem) return;

src/commands/quickCommand.steps.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,14 +108,14 @@ export async function getBranches(
108108
repos: Repository | Repository[],
109109
options: { filterBranches?: (b: GitBranch) => boolean; picked?: string | string[] } = {},
110110
): Promise<BranchQuickPickItem[]> {
111-
return getBranchesAndOrTags(repos, ['branches'], options) as Promise<BranchQuickPickItem[]>;
111+
return getBranchesAndOrTags(repos, ['branches'], { sort: true, ...options }) as Promise<BranchQuickPickItem[]>;
112112
}
113113

114114
export async function getTags(
115115
repos: Repository | Repository[],
116116
options: { filterTags?: (t: GitTag) => boolean; picked?: string | string[] } = {},
117117
): Promise<TagQuickPickItem[]> {
118-
return getBranchesAndOrTags(repos, ['tags'], options) as Promise<TagQuickPickItem[]>;
118+
return getBranchesAndOrTags(repos, ['tags'], { sort: true, ...options }) as Promise<TagQuickPickItem[]>;
119119
}
120120

121121
export async function getBranchesAndOrTags(
@@ -537,7 +537,7 @@ export async function* pickBranchOrTagStep<
537537
return getBranchesAndOrTags(state.repo, context.showTags ? ['branches', 'tags'] : ['branches'], {
538538
filter: filter,
539539
picked: picked,
540-
sort: { branches: { orderBy: BranchSorting.DateDesc }, tags: { orderBy: TagSorting.DateDesc } },
540+
sort: true,
541541
});
542542
};
543543
const branchesAndOrTags = await getBranchesAndOrTagsFn();

src/quickpicks/referencePicker.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -160,10 +160,7 @@ export namespace ReferencePicker {
160160
{
161161
filter: filter,
162162
picked: picked,
163-
sort: sort ?? {
164-
branches: { current: false, orderBy: BranchSorting.DateDesc },
165-
tags: { orderBy: TagSorting.DateDesc },
166-
},
163+
sort: sort ?? { branches: { current: false }, tags: {} },
167164
},
168165
);
169166

src/views/nodes/compareBranchNode.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { ThemeIcon, TreeItem, TreeItemCollapsibleState } from 'vscode';
33
import { BranchesView } from '../branchesView';
44
import { CommitsView } from '../commitsView';
55
import { BranchComparison, BranchComparisons, GlyphChars, WorkspaceState } from '../../constants';
6-
import { BranchSorting, TagSorting, ViewShowBranchComparison } from '../../configuration';
6+
import { ViewShowBranchComparison } from '../../configuration';
77
import { Container } from '../../container';
88
import { GitBranch, GitRevision } from '../../git/git';
99
import { GitUri } from '../../git/gitUri';
@@ -221,10 +221,7 @@ export class CompareBranchNode extends ViewNode<BranchesView | CommitsView | Rep
221221
allowEnteringRefs: true,
222222
picked: this.branch.ref,
223223
// checkmarks: true,
224-
sort: {
225-
branches: { current: true, orderBy: BranchSorting.DateDesc },
226-
tags: { orderBy: TagSorting.DateDesc },
227-
},
224+
sort: { branches: { current: true }, tags: {} },
228225
},
229226
);
230227
if (pick == null || pick instanceof CommandQuickPickItem) return;

src/views/nodes/fileHistoryTrackerNode.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
'use strict';
22
import { Disposable, TextEditor, TreeItem, TreeItemCollapsibleState, window } from 'vscode';
33
import { UriComparer } from '../../comparers';
4-
import { BranchSorting, TagSorting } from '../../configuration';
54
import { Container } from '../../container';
65
import { FileHistoryView } from '../fileHistoryView';
76
import { FileHistoryNode } from './fileHistoryNode';
@@ -96,10 +95,7 @@ export class FileHistoryTrackerNode extends SubscribeableViewNode<FileHistoryVie
9695
allowEnteringRefs: true,
9796
picked: this._base,
9897
// checkmarks: true,
99-
sort: {
100-
branches: { current: true, orderBy: BranchSorting.DateDesc },
101-
tags: { orderBy: TagSorting.DateDesc },
102-
},
98+
sort: { branches: { current: true }, tags: {} },
10399
},
104100
);
105101
if (pick == null) return;

src/views/nodes/lineHistoryTrackerNode.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
'use strict';
22
import { Selection, TreeItem, TreeItemCollapsibleState, window } from 'vscode';
33
import { UriComparer } from '../../comparers';
4-
import { BranchSorting, TagSorting } from '../../configuration';
54
import { Container } from '../../container';
65
import { FileHistoryView } from '../fileHistoryView';
76
import { GitReference, GitRevision } from '../../git/git';
@@ -102,10 +101,7 @@ export class LineHistoryTrackerNode extends SubscribeableViewNode<LineHistoryVie
102101
allowEnteringRefs: true,
103102
picked: this._base,
104103
// checkmarks: true,
105-
sort: {
106-
branches: { current: true, orderBy: BranchSorting.DateDesc },
107-
tags: { orderBy: TagSorting.DateDesc },
108-
},
104+
sort: { branches: { current: true }, tags: {} },
109105
},
110106
);
111107
if (pick == null) return;

src/views/searchAndCompareView.ts

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
'use strict';
22
import { commands, ConfigurationChangeEvent, TreeItem, TreeItemCollapsibleState } from 'vscode';
3-
import {
4-
BranchSorting,
5-
configuration,
6-
SearchAndCompareViewConfig,
7-
TagSorting,
8-
ViewFilesLayout,
9-
} from '../configuration';
3+
import { configuration, SearchAndCompareViewConfig, ViewFilesLayout } from '../configuration';
104
import { ContextKeys, NamedRef, PinnedItem, PinnedItems, setContext, WorkspaceState } from '../constants';
115
import { Container } from '../container';
126
import { GitLog, GitRevision, SearchPattern } from '../git/git';
@@ -154,10 +148,7 @@ export class SearchAndCompareViewNode extends ViewNode<SearchAndCompareView> {
154148
ReferencesQuickPickIncludes.BranchesAndTags |
155149
ReferencesQuickPickIncludes.HEAD |
156150
ReferencesQuickPickIncludes.WorkingTree,
157-
sort: {
158-
branches: { current: true, orderBy: BranchSorting.DateDesc },
159-
tags: { orderBy: TagSorting.DateDesc },
160-
},
151+
sort: { branches: { current: true } },
161152
},
162153
);
163154
if (pick == null) {
@@ -194,10 +185,7 @@ export class SearchAndCompareViewNode extends ViewNode<SearchAndCompareView> {
194185
ReferencesQuickPickIncludes.BranchesAndTags |
195186
ReferencesQuickPickIncludes.HEAD |
196187
ReferencesQuickPickIncludes.WorkingTree,
197-
sort: {
198-
branches: { current: true, orderBy: BranchSorting.DateDesc },
199-
tags: { orderBy: TagSorting.DateDesc },
200-
},
188+
sort: { branches: { current: true }, tags: {} },
201189
});
202190
if (pick == null) {
203191
await this.triggerChange();

0 commit comments

Comments
 (0)