From a50278d1168b1fe91421244b2c307795623ef56f Mon Sep 17 00:00:00 2001 From: Jan Bicker Date: Fri, 30 Aug 2019 12:58:55 +0000 Subject: [PATCH 1/2] Fixed a bug which caused that creating a branch didn't work anymore. Signed-off-by: Jan Bicker --- packages/git/src/browser/git-quick-open-service.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/git/src/browser/git-quick-open-service.ts b/packages/git/src/browser/git-quick-open-service.ts index fb35cd7d721db..78f5ed452185d 100644 --- a/packages/git/src/browser/git-quick-open-service.ts +++ b/packages/git/src/browser/git-quick-open-service.ts @@ -274,7 +274,7 @@ export class GitQuickOpenService { }; const items: QuickOpenItem[] = branches.map(branch => new GitQuickOpenItem(branch, this.wrapWithProgress(switchBranch), toLabel, toDescription)); const createBranchItem = async (item: QuickOpenItem) => { - const { git, gitErrorHandler, wrapWithProgress } = this; + const { git, gitErrorHandler, doWrapWithProgress } = this; const createBranchModel: QuickOpenModel = { onType(lookFor: string, acceptor: (items: QuickOpenItem[]) => void): void { const dynamicItems: QuickOpenItem[] = []; @@ -284,7 +284,7 @@ export class GitQuickOpenService { } else { dynamicItems.push(new SingleStringInputOpenItem( `Create a new local branch with name: ${lookFor}. ${suffix}`, - wrapWithProgress(async () => { + doWrapWithProgress(async () => { try { await git.branch(repository, { toCreate: lookFor }); await git.checkout(repository, { branch: lookFor }); @@ -590,6 +590,7 @@ export class GitQuickOpenService { return this.progressService.withProgress('', 'scm', fn); } + protected readonly doWrapWithProgress = (fn: (...args: []) => Promise) => this.wrapWithProgress(fn); protected wrapWithProgress(fn: (...args: In[]) => Promise): (...args: In[]) => Promise { return (...args: In[]) => this.withProgress(() => fn(...args)); } From 548bb1ef98e651630ca172e59f68332b7ef42209 Mon Sep 17 00:00:00 2001 From: Jan Bicker Date: Fri, 30 Aug 2019 14:12:52 +0000 Subject: [PATCH 2/2] Minor fix for buildDefaultProjectPath Signed-off-by: Jan Bicker --- packages/git/src/browser/git-quick-open-service.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/packages/git/src/browser/git-quick-open-service.ts b/packages/git/src/browser/git-quick-open-service.ts index 78f5ed452185d..df67d401f017c 100644 --- a/packages/git/src/browser/git-quick-open-service.ts +++ b/packages/git/src/browser/git-quick-open-service.ts @@ -97,7 +97,8 @@ export class GitQuickOpenService { }); } - private async buildDefaultProjectPath(folderPath: string, gitURI: string): Promise { + private buildDefaultProjectPath = this.doBuildDefaultProjectPath.bind(this); + private async doBuildDefaultProjectPath(folderPath: string, gitURI: string): Promise { if (!(await this.fileSystem.exists(folderPath))) { // user specifies its own project path, doesn't want us to guess it return folderPath; @@ -274,7 +275,7 @@ export class GitQuickOpenService { }; const items: QuickOpenItem[] = branches.map(branch => new GitQuickOpenItem(branch, this.wrapWithProgress(switchBranch), toLabel, toDescription)); const createBranchItem = async (item: QuickOpenItem) => { - const { git, gitErrorHandler, doWrapWithProgress } = this; + const { git, gitErrorHandler, wrapWithProgress } = this; const createBranchModel: QuickOpenModel = { onType(lookFor: string, acceptor: (items: QuickOpenItem[]) => void): void { const dynamicItems: QuickOpenItem[] = []; @@ -284,7 +285,7 @@ export class GitQuickOpenService { } else { dynamicItems.push(new SingleStringInputOpenItem( `Create a new local branch with name: ${lookFor}. ${suffix}`, - doWrapWithProgress(async () => { + wrapWithProgress(async () => { try { await git.branch(repository, { toCreate: lookFor }); await git.checkout(repository, { branch: lookFor }); @@ -590,8 +591,8 @@ export class GitQuickOpenService { return this.progressService.withProgress('', 'scm', fn); } - protected readonly doWrapWithProgress = (fn: (...args: []) => Promise) => this.wrapWithProgress(fn); - protected wrapWithProgress(fn: (...args: In[]) => Promise): (...args: In[]) => Promise { + protected readonly wrapWithProgress = (fn: (...args: In[]) => Promise) => this.doWrapWithProgress(fn); + protected doWrapWithProgress(fn: (...args: In[]) => Promise): (...args: In[]) => Promise { return (...args: In[]) => this.withProgress(() => fn(...args)); }