From 89b4f105d295215409885ff74aece0e0fc04613c Mon Sep 17 00:00:00 2001 From: Eric Amodio Date: Wed, 30 Aug 2023 23:49:35 -0400 Subject: [PATCH] Fixes opening changes for renamed files --- CHANGELOG.md | 1 + src/git/actions/commit.ts | 10 +++++----- src/webviews/commitDetails/commitDetailsWebview.ts | 8 ++++---- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 35a9e2c..a9bac72 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p ### Fixed - 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 diff --git a/src/git/actions/commit.ts b/src/git/actions/commit.ts index dd10501..d77a4e9 100644 --- a/src/git/actions/commit.ts +++ b/src/git/actions/commit.ts @@ -236,14 +236,14 @@ export async function openChanges( } : 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(Commands.DiffWith, { 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, })); } diff --git a/src/webviews/commitDetails/commitDetailsWebview.ts b/src/webviews/commitDetails/commitDetailsWebview.ts index c8e102b..ff8dc26 100644 --- a/src/webviews/commitDetails/commitDetailsWebview.ts +++ b/src/webviews/commitDetails/commitDetailsWebview.ts @@ -903,7 +903,7 @@ export class CommitDetailsWebviewProvider implements WebviewProvider