diff --git a/src/env/node/git/localGitProvider.ts b/src/env/node/git/localGitProvider.ts index 7392a00..39ab11b 100644 --- a/src/env/node/git/localGitProvider.ts +++ b/src/env/node/git/localGitProvider.ts @@ -3463,34 +3463,21 @@ export class LocalGitProvider implements GitProvider, Disposable { } } - async resolveReference( - repoPath: string, - ref: string, - fileName?: string, - options?: { timeout?: number }, - ): Promise; - async resolveReference(repoPath: string, ref: string, uri?: Uri, options?: { timeout?: number }): Promise; @log() - async resolveReference( - repoPath: string, - ref: string, - fileNameOrUri?: string | Uri, - options?: { timeout?: number }, - ) { - if (ref == null || ref.length === 0 || ref === GitRevision.deletedOrMissing || GitRevision.isUncommitted(ref)) { + async resolveReference(repoPath: string, ref: string, pathOrUri?: string | Uri, options?: { timeout?: number }) { + if (!ref || ref === GitRevision.deletedOrMissing || GitRevision.isUncommitted(ref)) { return ref; } - if (fileNameOrUri == null) { + if (pathOrUri == null) { if (GitRevision.isSha(ref) || !GitRevision.isShaLike(ref) || ref.endsWith('^3')) return ref; return (await Git.rev_parse__verify(repoPath, ref)) ?? ref; } - const fileName = - typeof fileNameOrUri === 'string' ? fileNameOrUri : normalizePath(relative(repoPath, fileNameOrUri.fsPath)); + const path = typeof pathOrUri === 'string' ? pathOrUri : normalizePath(relative(repoPath, pathOrUri.fsPath)); - const blob = await Git.rev_parse__verify(repoPath, ref, fileName); + const blob = await Git.rev_parse__verify(repoPath, ref, path); if (blob == null) return GitRevision.deletedOrMissing; let promise: Promise = Git.log__find_object( @@ -3498,7 +3485,7 @@ export class LocalGitProvider implements GitProvider, Disposable { blob, ref, this.container.config.advanced.commitOrdering, - fileName, + path, ); if (options?.timeout != null) { promise = Promise.race([promise, Functions.wait(options.timeout)]); diff --git a/src/git/gitProvider.ts b/src/git/gitProvider.ts index 071b5b3..30652ab 100644 --- a/src/git/gitProvider.ts +++ b/src/git/gitProvider.ts @@ -366,19 +366,7 @@ export interface GitProvider { resolveReference( repoPath: string, ref: string, - fileName?: string, - options?: { timeout?: number | undefined }, - ): Promise; - resolveReference( - repoPath: string, - ref: string, - uri?: Uri, - options?: { timeout?: number | undefined }, - ): Promise; - resolveReference( - repoPath: string, - ref: string, - fileNameOrUri?: string | Uri, + pathOrUri?: string | Uri, options?: { timeout?: number | undefined }, ): Promise; validateBranchOrTagName(repoPath: string, ref: string): Promise; diff --git a/src/git/gitProviderService.ts b/src/git/gitProviderService.ts index 2b888bf..ba9ef24 100644 --- a/src/git/gitProviderService.ts +++ b/src/git/gitProviderService.ts @@ -1784,7 +1784,7 @@ export class GitProviderService implements Disposable { async resolveReference( repoPath: string, ref: string, - fileName?: string, + path?: string, options?: { timeout?: number }, ): Promise; async resolveReference(repoPath: string, ref: string, uri?: Uri, options?: { timeout?: number }): Promise; @@ -1792,15 +1792,15 @@ export class GitProviderService implements Disposable { async resolveReference( repoPath: string | Uri, ref: string, - fileNameOrUri?: string | Uri, + pathOrUri?: string | Uri, options?: { timeout?: number }, ) { - if (ref == null || ref.length === 0 || ref === GitRevision.deletedOrMissing || GitRevision.isUncommitted(ref)) { + if (!ref || ref === GitRevision.deletedOrMissing || GitRevision.isUncommitted(ref)) { return ref; } const { provider, path } = this.getProvider(repoPath); - return provider.resolveReference(path, ref, fileNameOrUri, options); + return provider.resolveReference(path, ref, pathOrUri, options); } @log()