diff --git a/src/git/gitProviderService.ts b/src/git/gitProviderService.ts index ba9ef24..e9ceb3a 100644 --- a/src/git/gitProviderService.ts +++ b/src/git/gitProviderService.ts @@ -1288,20 +1288,17 @@ export class GitProviderService implements Disposable { provider: RichRemoteProvider, options?: { avatarSize?: number; include?: PullRequestState[]; limit?: number; timeout?: number }, ): Promise; - @gate((ref, remoteOrProvider, options) => { + @gate((branch, remoteOrProvider, options) => { const provider = GitRemote.is(remoteOrProvider) ? remoteOrProvider.provider : remoteOrProvider; - return `${ref}${provider != null ? `|${provider.id}:${provider.domain}/${provider.path}` : ''}${ - options != null ? `|${options.limit ?? -1}:${options.include?.join(',')}` : '' - }`; + return `${branch}${ + provider != null ? `|${provider.id}:${provider.domain}/${provider.path}` : '' + }|${JSON.stringify(options)}`; }) @debug({ args: { 1: remoteOrProvider => remoteOrProvider.name } }) async getPullRequestForBranch( branch: string, remoteOrProvider: GitRemote | RichRemoteProvider, - { - timeout, - ...options - }: { avatarSize?: number; include?: PullRequestState[]; limit?: number; timeout?: number } = {}, + options?: { avatarSize?: number; include?: PullRequestState[]; limit?: number; timeout?: number }, ): Promise { let provider; if (GitRemote.is(remoteOrProvider)) { @@ -1311,6 +1308,11 @@ export class GitProviderService implements Disposable { provider = remoteOrProvider; } + let timeout; + if (options != null) { + ({ timeout, ...options } = options); + } + let promiseOrPR = provider.getPullRequestForBranch(branch, options); if (promiseOrPR == null || !Promises.is(promiseOrPR)) { return promiseOrPR; @@ -1351,7 +1353,7 @@ export class GitProviderService implements Disposable { async getPullRequestForCommit( ref: string, remoteOrProvider: GitRemote | RichRemoteProvider, - { timeout }: { timeout?: number } = {}, + options?: { timeout?: number }, ): Promise { if (GitRevision.isUncommitted(ref)) return undefined; @@ -1368,8 +1370,8 @@ export class GitProviderService implements Disposable { return promiseOrPR; } - if (timeout != null && timeout > 0) { - promiseOrPR = Promises.cancellable(promiseOrPR, timeout); + if (options?.timeout != null && options.timeout > 0) { + promiseOrPR = Promises.cancellable(promiseOrPR, options.timeout); } try {