Browse Source

Removes `previous*` props to avoid confusion

main
Eric Amodio 3 years ago
parent
commit
8ddfa2b152
7 changed files with 8 additions and 21 deletions
  1. +1
    -1
      src/commands/diffLineWithWorking.ts
  2. +1
    -1
      src/commands/diffWith.ts
  3. +1
    -5
      src/commands/openRevisionFile.ts
  4. +2
    -2
      src/git/formatters/commitFormatter.ts
  5. +1
    -1
      src/git/models/commit.ts
  6. +0
    -9
      src/git/models/file.ts
  7. +2
    -2
      src/premium/github/github.ts

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

@ -59,7 +59,7 @@ export class DiffLineWithWorkingCommand extends ActiveEditorCommand {
);
} else {
lhsSha = args.commit.file!.previousSha ?? GitRevision.deletedOrMissing;
lhsUri = args.commit.file!.previousUri;
lhsUri = args.commit.file!.originalUri ?? args.commit.file!.uri;
}
} else {
lhsSha = args.commit.sha;

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

@ -53,7 +53,7 @@ export class DiffWithCommand extends Command {
repoPath: commit.repoPath,
lhs: {
sha: commit.file.previousSha ?? GitRevision.deletedOrMissing,
uri: commit.file.previousUri,
uri: commit.file.originalUri ?? commit.file.uri,
},
rhs: {
sha: commit.sha,

+ 1
- 5
src/commands/openRevisionFile.ts View File

@ -39,11 +39,7 @@ export class OpenRevisionFileCommand extends ActiveEditorCommand {
args.revisionUri =
commit?.file?.status === 'D'
? this.container.git.getRevisionUri(
commit.previousSha,
commit.file.previousUri.fsPath,
commit.repoPath,
)
? this.container.git.getRevisionUri(commit.previousSha, commit.file, commit.repoPath)
: this.container.git.getRevisionUri(gitUri);
} else {
args.revisionUri = this.container.git.getRevisionUri(gitUri);

+ 2
- 2
src/git/formatters/commitFormatter.ts View File

@ -319,10 +319,10 @@ export class CommitFormatter extends Formatter {
this._options.editor?.line,
)} "Open Changes with Previous Revision")`;
if (this._item.previousSha != null && this._item.file?.previousPath != null) {
if (this._item.previousSha != null && this._item.file?.originalPath != null) {
const uri = Container.instance.git.getRevisionUri(
this._item.previousSha,
this._item.file.previousPath,
this._item.file.originalPath,
this._item.repoPath,
);
commands += `   [$(versions)](${OpenFileAtRevisionCommand.getMarkdownCommandArgs(

+ 1
- 1
src/git/models/commit.ts View File

@ -400,7 +400,7 @@ export class GitCommit implements GitRevisionReference {
const uri = this._file?.uri ?? this.container.git.getAbsoluteUri(this.repoPath, this.repoPath);
if (!previous) return new GitUri(uri, this);
return new GitUri(this._file?.previousUri ?? uri, {
return new GitUri(this._file?.originalUri ?? uri, {
repoPath: this.repoPath,
sha: this.previousSha,
});

+ 0
- 9
src/git/models/file.ts View File

@ -202,10 +202,6 @@ export class GitFileChange {
}
}
get previousPath(): string {
return this.originalPath || this.path;
}
@memoize()
get uri(): Uri {
return Container.instance.git.getAbsoluteUri(this.path, this.repoPath);
@ -217,11 +213,6 @@ export class GitFileChange {
}
@memoize()
get previousUri(): Uri {
return Container.instance.git.getAbsoluteUri(this.previousPath, this.repoPath);
}
@memoize()
getWorkingUri(): Promise<Uri | undefined> {
return Container.instance.git.getWorkingUri(this.repoPath, this.uri);
}

+ 2
- 2
src/premium/github/github.ts View File

@ -1451,7 +1451,7 @@ export class GitHubApi {
try {
if (!path) {
interface QueryResult {
repository: { object: { oid: string } } | null | undefined;
repository: { object: GitHubCommitRef } | null | undefined;
}
const query = `query resolveReference(
@ -1479,7 +1479,7 @@ export class GitHubApi {
| {
object: {
history: {
nodes: { oid: string }[];
nodes: GitHubCommitRef[];
};
};
}

Loading…
Cancel
Save