From abcd302580846842e9e9ceea830334918213ed72 Mon Sep 17 00:00:00 2001 From: Eric Amodio Date: Sat, 8 Jan 2022 17:33:29 -0500 Subject: [PATCH] Changes take Uri rather than string file name For virtual workspaces. Will be continually converting strings to Uris --- src/annotations/blameAnnotationProvider.ts | 2 +- src/annotations/gutterChangesAnnotationProvider.ts | 6 +++--- src/commands/openFileOnRemote.ts | 10 +++------- src/commands/showQuickCommitFile.ts | 2 +- src/env/node/git/localGitProvider.ts | 4 ++-- src/git/gitProvider.ts | 2 +- src/git/gitProviderService.ts | 4 ++-- src/hovers/lineHoverController.ts | 2 +- 8 files changed, 14 insertions(+), 18 deletions(-) diff --git a/src/annotations/blameAnnotationProvider.ts b/src/annotations/blameAnnotationProvider.ts index 4acfc23..7598858 100644 --- a/src/annotations/blameAnnotationProvider.ts +++ b/src/annotations/blameAnnotationProvider.ts @@ -176,7 +176,7 @@ export abstract class BlameAnnotationProviderBase extends AnnotationProviderBase // Get the full commit message -- since blame only returns the summary let logCommit: GitCommit | undefined = undefined; if (!commit.isUncommitted) { - logCommit = await this.container.git.getCommitForFile(commit.repoPath, commit.uri.fsPath, { + logCommit = await this.container.git.getCommitForFile(commit.repoPath, commit.uri, { ref: commit.sha, }); if (logCommit != null) { diff --git a/src/annotations/gutterChangesAnnotationProvider.ts b/src/annotations/gutterChangesAnnotationProvider.ts index 66709a2..fcb8e80 100644 --- a/src/annotations/gutterChangesAnnotationProvider.ts +++ b/src/annotations/gutterChangesAnnotationProvider.ts @@ -86,7 +86,7 @@ export class GutterChangesAnnotationProvider extends AnnotationProviderBase { const cc = Logger.getCorrelationContext(); try { - const log = await this.getLogForFile(repoPath, fileName, { + const log = await this.getLogForFile(repoPath, uri.fsPath, { limit: 2, ref: options.ref, range: options.range, diff --git a/src/git/gitProvider.ts b/src/git/gitProvider.ts index 6da8ede..7db4dbe 100644 --- a/src/git/gitProvider.ts +++ b/src/git/gitProvider.ts @@ -136,7 +136,7 @@ export interface GitProvider { getCommitCount(repoPath: string, ref: string): Promise; getCommitForFile( repoPath: string, - fileName: string, + uri: Uri, options?: { ref?: string | undefined; firstIfNotFound?: boolean | undefined; diff --git a/src/git/gitProviderService.ts b/src/git/gitProviderService.ts index 9f873df..0c8c2e7 100644 --- a/src/git/gitProviderService.ts +++ b/src/git/gitProviderService.ts @@ -966,13 +966,13 @@ export class GitProviderService implements Disposable { @log() async getCommitForFile( repoPath: string | Uri | undefined, - fileName: string, + uri: Uri, options?: { ref?: string; firstIfNotFound?: boolean; range?: Range; reverse?: boolean }, ): Promise { if (repoPath == null) return undefined; const { provider, path } = this.getProvider(repoPath); - return provider.getCommitForFile(path, fileName, options); + return provider.getCommitForFile(path, uri, options); } @log() diff --git a/src/hovers/lineHoverController.ts b/src/hovers/lineHoverController.ts index 44827f2..a25ecfb 100644 --- a/src/hovers/lineHoverController.ts +++ b/src/hovers/lineHoverController.ts @@ -119,7 +119,7 @@ export class LineHoverController implements Disposable { // Get the full commit message -- since blame only returns the summary let logCommit = lineState?.logCommit; if (logCommit == null && !commit.isUncommitted) { - logCommit = await this.container.git.getCommitForFile(commit.repoPath, commit.uri.fsPath, { + logCommit = await this.container.git.getCommitForFile(commit.repoPath, commit.uri, { ref: commit.sha, }); if (logCommit != null) {