Skip to content

Commit

Permalink
fixes #21439
Browse files Browse the repository at this point in the history
  • Loading branch information
joaomoreno committed Jul 5, 2017
1 parent 98db8e7 commit 313aad1
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions extensions/git/src/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,16 @@ class MergeItem implements QuickPickItem {
}
}

class CreateBranchItem implements QuickPickItem {

get label(): string { return localize('create branch', '$(plus) Create new branch'); }
get description(): string { return ''; }

async run(model: Model): Promise<void> {
await commands.executeCommand('git.branch');
}
}

interface Command {
commandId: string;
key: string;
Expand Down Expand Up @@ -728,6 +738,8 @@ export class CommandCenter {
const includeTags = checkoutType === 'all' || checkoutType === 'tags';
const includeRemotes = checkoutType === 'all' || checkoutType === 'remote';

const createBranch = new CreateBranchItem();

const heads = this.model.refs.filter(ref => ref.type === RefType.Head)
.map(ref => new CheckoutItem(ref));

Expand All @@ -737,9 +749,9 @@ export class CommandCenter {
const remoteHeads = (includeRemotes ? this.model.refs.filter(ref => ref.type === RefType.RemoteHead) : [])
.map(ref => new CheckoutRemoteHeadItem(ref));

const picks = [...heads, ...tags, ...remoteHeads];
const picks = [createBranch, ...heads, ...tags, ...remoteHeads];
const placeHolder = localize('select a ref to checkout', 'Select a ref to checkout');
const choice = await window.showQuickPick<CheckoutItem>(picks, { placeHolder });
const choice = await window.showQuickPick(picks, { placeHolder });

if (!choice) {
return;
Expand Down

0 comments on commit 313aad1

Please sign in to comment.