Skip to content

Commit eeb3857

Browse files
committed
Merge branch 'master' of https://github.com/ryapapap/vscode into ryapapap-master
2 parents 27cc191 + 7831f77 commit eeb3857

4 files changed

Lines changed: 18 additions & 2 deletions

File tree

src/vs/workbench/parts/git/browser/gitQuickOpen.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,12 +137,16 @@ class CheckoutCommand implements ICommand {
137137
getResults(input: string): TPromise<QuickOpenEntry[]> {
138138
input = input.trim();
139139

140+
const checkoutType = this.gitService.checkoutType;
141+
const includeTags = checkoutType === 'all' || checkoutType === 'tags';
142+
const includeRemotes = checkoutType === 'all' || checkoutType === 'remote';
143+
140144
const gitModel = this.gitService.getModel();
141145
const currentHead = gitModel.getHEAD();
142146
const refs = gitModel.getRefs();
143147
const heads = refs.filter(ref => ref.type === RefType.Head);
144-
const tags = refs.filter(ref => ref.type === RefType.Tag);
145-
const remoteHeads = refs.filter(ref => ref.type === RefType.RemoteHead);
148+
const tags = includeTags ? refs.filter(ref => ref.type === RefType.Tag) : [];
149+
const remoteHeads = includeRemotes ? refs.filter(ref => ref.type === RefType.RemoteHead) : [];
146150

147151
const headMatches = heads
148152
.map(head => ({ head, highlights: matchesContiguousSubString(input, head.name) }))

src/vs/workbench/parts/git/browser/gitServices.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,10 @@ export class GitService extends EventEmitter
418418
this.transition(ServiceState.OK);
419419
}
420420
}
421+
get checkoutType(): string {
422+
const { checkoutType } = this.configurationService.getConfiguration<IGitConfiguration>('git');
423+
return checkoutType;
424+
}
421425

422426
get onOutput(): Event<string> { return this.raw.onOutput; }
423427

src/vs/workbench/parts/git/browser/gitWorkbenchContributions.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,12 @@ export function registerContributions(): void {
221221
enum: ['all', 'tracked', 'off'],
222222
default: 'all',
223223
description: nls.localize('countBadge', "Controls the git badge counter."),
224+
},
225+
'git.checkoutType': {
226+
type: 'string',
227+
enum: ['all', 'local', 'tags', 'remote'],
228+
default: 'all',
229+
description: nls.localize('checkoutType', "Controls what type of branches are listed."),
224230
}
225231
}
226232
});

src/vs/workbench/parts/git/common/git.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,7 @@ export interface IGitConfiguration {
242242
allowLargeRepositories: boolean;
243243
confirmSync: boolean;
244244
countBadge: string;
245+
checkoutType: string;
245246
}
246247

247248
// Service interfaces
@@ -305,6 +306,7 @@ export const IGitService = createDecorator<IGitService>(GIT_SERVICE_ID);
305306
export interface IGitService extends IEventEmitter {
306307
_serviceBrand: any;
307308
allowHugeRepositories: boolean;
309+
checkoutType: string;
308310
onOutput: Event<string>;
309311
status(): TPromise<IModel>;
310312
init(): TPromise<IModel>;

0 commit comments

Comments
 (0)