Browse Source

Changes take Uri rather than string file name

For virtual workspaces. Will be continually converting strings to Uris
main
Eric Amodio 3 years ago
parent
commit
abcd302580
8 changed files with 14 additions and 18 deletions
  1. +1
    -1
      src/annotations/blameAnnotationProvider.ts
  2. +3
    -3
      src/annotations/gutterChangesAnnotationProvider.ts
  3. +3
    -7
      src/commands/openFileOnRemote.ts
  4. +1
    -1
      src/commands/showQuickCommitFile.ts
  5. +2
    -2
      src/env/node/git/localGitProvider.ts
  6. +1
    -1
      src/git/gitProvider.ts
  7. +2
    -2
      src/git/gitProviderService.ts
  8. +1
    -1
      src/hovers/lineHoverController.ts

+ 1
- 1
src/annotations/blameAnnotationProvider.ts View File

@ -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) {

+ 3
- 3
src/annotations/gutterChangesAnnotationProvider.ts View File

@ -86,7 +86,7 @@ export class GutterChangesAnnotationProvider extends AnnotationProviderBase
ref = `${ref}^`;
commit = await this.container.git.getCommitForFile(
this.trackedDocument.uri.repoPath,
this.trackedDocument.uri.fsPath,
this.trackedDocument.uri,
{ ref: ref },
);
if (commit != null) {
@ -110,7 +110,7 @@ export class GutterChangesAnnotationProvider extends AnnotationProviderBase
if (commits?.length) {
commit = await this.container.git.getCommitForFile(
this.trackedDocument.uri.repoPath,
this.trackedDocument.uri.fsPath,
this.trackedDocument.uri,
);
ref1 = 'HEAD';
} else if (this.trackedDocument.dirty) {
@ -124,7 +124,7 @@ export class GutterChangesAnnotationProvider extends AnnotationProviderBase
if (!localChanges) {
commit = await this.container.git.getCommitForFile(
this.trackedDocument.uri.repoPath,
this.trackedDocument.uri.fsPath,
this.trackedDocument.uri,
{
ref: ref2 ?? ref1,
},

+ 3
- 7
src/commands/openFileOnRemote.ts View File

@ -84,13 +84,9 @@ export class OpenFileOnRemoteCommand extends ActiveEditorCommand {
const gitUri = await GitUri.fromUri(uri);
if (gitUri.repoPath) {
if (gitUri.sha == null) {
const commit = await Container.instance.git.getCommitForFile(
gitUri.repoPath,
gitUri.fsPath,
{
firstIfNotFound: true,
},
);
const commit = await Container.instance.git.getCommitForFile(gitUri.repoPath, gitUri, {
firstIfNotFound: true,
});
if (commit != null) {
args.sha = commit.sha;

+ 1
- 1
src/commands/showQuickCommitFile.ts View File

@ -115,7 +115,7 @@ export class ShowQuickCommitFileCommand extends ActiveEditorCachedCommand {
if (args.fileLog === undefined) {
const repoPath = args.commit === undefined ? gitUri.repoPath : args.commit.repoPath;
args.commit = await Container.instance.git.getCommitForFile(repoPath, gitUri.fsPath, {
args.commit = await Container.instance.git.getCommitForFile(repoPath, gitUri, {
ref: args.sha,
});
if (args.commit === undefined) {

+ 2
- 2
src/env/node/git/localGitProvider.ts View File

@ -1186,13 +1186,13 @@ export class LocalGitProvider implements GitProvider, Disposable {
@log()
async getCommitForFile(
repoPath: string | undefined,
fileName: string,
uri: Uri,
options: { ref?: string; firstIfNotFound?: boolean; range?: Range; reverse?: boolean } = {},
): Promise<GitLogCommit | undefined> {
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,

+ 1
- 1
src/git/gitProvider.ts View File

@ -136,7 +136,7 @@ export interface GitProvider {
getCommitCount(repoPath: string, ref: string): Promise<number | undefined>;
getCommitForFile(
repoPath: string,
fileName: string,
uri: Uri,
options?: {
ref?: string | undefined;
firstIfNotFound?: boolean | undefined;

+ 2
- 2
src/git/gitProviderService.ts View File

@ -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<GitLogCommit | undefined> {
if (repoPath == null) return undefined;
const { provider, path } = this.getProvider(repoPath);
return provider.getCommitForFile(path, fileName, options);
return provider.getCommitForFile(path, uri, options);
}
@log()

+ 1
- 1
src/hovers/lineHoverController.ts View File

@ -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) {

Loading…
Cancel
Save