Skip to content

Commit

Permalink
Minor fix for buildDefaultProjectPath
Browse files Browse the repository at this point in the history
Signed-off-by: Jan Bicker <[email protected]>
  • Loading branch information
jbicker committed Aug 30, 2019
1 parent 27d3cff commit 1bd17a3
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions packages/git/src/browser/git-quick-open-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ export class GitQuickOpenService {
});
}

private async buildDefaultProjectPath(folderPath: string, gitURI: string): Promise<string> {
private buildDefaultProjectPath = this.doBuildDefaultProjectPath.bind(this);
private async doBuildDefaultProjectPath(folderPath: string, gitURI: string): Promise<string> {
if (!(await this.fileSystem.exists(folderPath))) {
// user specifies its own project path, doesn't want us to guess it
return folderPath;
Expand Down Expand Up @@ -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[] = [];
Expand All @@ -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 });
Expand Down Expand Up @@ -590,8 +591,8 @@ export class GitQuickOpenService {
return this.progressService.withProgress('', 'scm', fn);
}

protected readonly doWrapWithProgress = (fn: (...args: []) => Promise<void>) => this.wrapWithProgress(fn);
protected wrapWithProgress<In, Out>(fn: (...args: In[]) => Promise<Out>): (...args: In[]) => Promise<Out> {
protected readonly wrapWithProgress = <In, Out>(fn: (...args: In[]) => Promise<Out>) => this.doWrapWithProgress(fn);
protected doWrapWithProgress<In, Out>(fn: (...args: In[]) => Promise<Out>): (...args: In[]) => Promise<Out> {
return (...args: In[]) => this.withProgress(() => fn(...args));
}

Expand Down

0 comments on commit 1bd17a3

Please sign in to comment.