Browse Source

Fixes opening changes for renamed files

main
Eric Amodio 1 year ago
parent
commit
89b4f105d2
3 changed files with 10 additions and 9 deletions
  1. +1
    -0
      CHANGELOG.md
  2. +5
    -5
      src/git/actions/commit.ts
  3. +4
    -4
      src/webviews/commitDetails/commitDetailsWebview.ts

+ 1
- 0
CHANGELOG.md View File

@ -19,6 +19,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
### Fixed ### Fixed
- Fixes [#2885](https://github.com/gitkraken/vscode-gitlens/issues/2885) - Folder History not show changed files of commit - Fixes [#2885](https://github.com/gitkraken/vscode-gitlens/issues/2885) - Folder History not show changed files of commit
- Fixes issues with opening changes (diffs) of renamed files
## [14.2.1] - 2023-08-10 ## [14.2.1] - 2023-08-10

+ 5
- 5
src/git/actions/commit.ts View File

@ -236,14 +236,14 @@ export async function openChanges(
} }
: commitOrRefs; : commitOrRefs;
const uri1 = GitUri.fromFile(file, refs.repoPath);
const uri2 =
file.status === 'R' || file.status === 'C' ? GitUri.fromFile(file, refs.repoPath, refs.ref2, true) : uri1;
const rhsUri = GitUri.fromFile(file, refs.repoPath);
const lhsUri =
file.status === 'R' || file.status === 'C' ? GitUri.fromFile(file, refs.repoPath, refs.ref1, true) : rhsUri;
void (await executeCommand<DiffWithCommandArgs>(Commands.DiffWith, { void (await executeCommand<DiffWithCommandArgs>(Commands.DiffWith, {
repoPath: refs.repoPath, repoPath: refs.repoPath,
lhs: { uri: uri1, sha: refs.ref1 },
rhs: { uri: uri2, sha: refs.ref2 },
lhs: { uri: lhsUri, sha: refs.ref1 },
rhs: { uri: rhsUri, sha: refs.ref2 },
showOptions: options, showOptions: options,
})); }));
} }

+ 4
- 4
src/webviews/commitDetails/commitDetailsWebview.ts View File

@ -903,7 +903,7 @@ export class CommitDetailsWebviewProvider implements WebviewProvider
const [commit, file] = result; const [commit, file] = result;
this.suspendLineTracker(); this.suspendLineTracker();
void openChangesWithWorking(file.path, commit, {
void openChangesWithWorking(file, commit, {
preserveFocus: true, preserveFocus: true,
preview: true, preview: true,
...this.getShowOptions(params), ...this.getShowOptions(params),
@ -917,7 +917,7 @@ export class CommitDetailsWebviewProvider implements WebviewProvider
const [commit, file] = result; const [commit, file] = result;
this.suspendLineTracker(); this.suspendLineTracker();
void openChanges(file.path, commit, {
void openChanges(file, commit, {
preserveFocus: true, preserveFocus: true,
preview: true, preview: true,
...this.getShowOptions(params), ...this.getShowOptions(params),
@ -932,7 +932,7 @@ export class CommitDetailsWebviewProvider implements WebviewProvider
const [commit, file] = result; const [commit, file] = result;
this.suspendLineTracker(); this.suspendLineTracker();
void openFile(file.path, commit, {
void openFile(file, commit, {
preserveFocus: true, preserveFocus: true,
preview: true, preview: true,
...this.getShowOptions(params), ...this.getShowOptions(params),
@ -945,7 +945,7 @@ export class CommitDetailsWebviewProvider implements WebviewProvider
const [commit, file] = result; const [commit, file] = result;
void openFileOnRemote(file.path, commit);
void openFileOnRemote(file, commit);
} }
private getShowOptions(params: FileActionParams): TextDocumentShowOptions | undefined { private getShowOptions(params: FileActionParams): TextDocumentShowOptions | undefined {

Loading…
Cancel
Save