From 00e96602276e6e710d37834ec3cdecbf17b450dd Mon Sep 17 00:00:00 2001 From: Eric Amodio Date: Mon, 27 Feb 2017 00:53:53 -0500 Subject: [PATCH] Fixes issue with repository status without changes --- src/commands/quickPickItems.ts | 2 +- src/commands/quickPicks.ts | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/commands/quickPickItems.ts b/src/commands/quickPickItems.ts index 749afb0..4d20a24 100644 --- a/src/commands/quickPickItems.ts +++ b/src/commands/quickPickItems.ts @@ -81,7 +81,7 @@ export class OpenCommitFilesCommandQuickPickItem extends OpenFilesCommandQuickPi export class OpenStatusFilesCommandQuickPickItem extends OpenFilesCommandQuickPickItem { constructor(statuses: GitFileStatusItem[], item?: PartialQuickPickItem) { - const repoPath = statuses[0].repoPath; + const repoPath = statuses.length && statuses[0].repoPath; const fileNames = statuses.map(_ => _.fileName); item = { diff --git a/src/commands/quickPicks.ts b/src/commands/quickPicks.ts index 16cefb2..c49489b 100644 --- a/src/commands/quickPicks.ts +++ b/src/commands/quickPicks.ts @@ -214,7 +214,10 @@ export class RepoStatusesQuickPick { })); } } - items.splice(0, 0, new OpenStatusFilesCommandQuickPickItem(statuses.filter(_ => _.status !== GitFileStatus.Deleted))); + + if (statuses.length) { + items.splice(0, 0, new OpenStatusFilesCommandQuickPickItem(statuses.filter(_ => _.status !== GitFileStatus.Deleted))); + } if (goBackCommand) { items.splice(0, 0, goBackCommand); @@ -222,7 +225,7 @@ export class RepoStatusesQuickPick { return await window.showQuickPick(items, { matchOnDescription: true, - placeHolder: 'Showing the repository status', + placeHolder: statuses.length ? 'Repository has changes' : 'Repository has no changes', ignoreFocusOut: getQuickPickIgnoreFocusOut() } as QuickPickOptions); }