Browse Source

Gives up waiting for resolve if too slow

main
Eric Amodio 2 years ago
parent
commit
f29f77fc0d
2 changed files with 3 additions and 2 deletions
  1. +2
    -2
      src/commands/diffWith.ts
  2. +1
    -0
      src/git/gitProviderService.ts

+ 2
- 2
src/commands/diffWith.ts View File

@ -93,11 +93,11 @@ export class DiffWithCommand extends Command {
[args.lhs.sha, args.rhs.sha] = await Promise.all([ [args.lhs.sha, args.rhs.sha] = await Promise.all([
await this.container.git.resolveReference(args.repoPath, args.lhs.sha, args.lhs.uri, { await this.container.git.resolveReference(args.repoPath, args.lhs.sha, args.lhs.uri, {
// If the ref looks like a sha, don't wait too long, since it should work // If the ref looks like a sha, don't wait too long, since it should work
timeout: GitRevision.isSha(args.lhs.sha) ? 100 : undefined,
timeout: GitRevision.isShaLike(args.lhs.sha) ? 100 : undefined,
}), }),
await this.container.git.resolveReference(args.repoPath, args.rhs.sha, args.rhs.uri, { await this.container.git.resolveReference(args.repoPath, args.rhs.sha, args.rhs.uri, {
// If the ref looks like a sha, don't wait too long, since it should work // If the ref looks like a sha, don't wait too long, since it should work
timeout: GitRevision.isSha(args.rhs.sha) ? 100 : undefined,
timeout: GitRevision.isShaLike(args.rhs.sha) ? 100 : undefined,
}), }),
]); ]);

+ 1
- 0
src/git/gitProviderService.ts View File

@ -2166,6 +2166,7 @@ export class GitProviderService implements Disposable {
options?: { timeout?: number }, options?: { timeout?: number },
): Promise<string>; ): Promise<string>;
async resolveReference(repoPath: string, ref: string, uri?: Uri, options?: { timeout?: number }): Promise<string>; async resolveReference(repoPath: string, ref: string, uri?: Uri, options?: { timeout?: number }): Promise<string>;
@gate()
@log() @log()
async resolveReference( async resolveReference(
repoPath: string | Uri, repoPath: string | Uri,

Loading…
Cancel
Save