From 6e5a82e469c754f807054869597816e5673c4d6a Mon Sep 17 00:00:00 2001 From: Eric Amodio Date: Wed, 25 Jul 2018 01:31:38 -0400 Subject: [PATCH] Fixes issue showing changes with working with renamed files --- CHANGELOG.md | 1 + src/commands/diffWithWorking.ts | 4 +++- src/git/models/commit.ts | 4 ++++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 27d0a03..be37d1c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p ### Fixed - Fixes [#454](https://github.com/eamodio/vscode-gitlens/issues/454) - Search for string returns merge commits (unlike raw `git log -S`) - Fixes issue showing changes with untracked stashed files +- Fixes issue showing changes with working file when the file has been renamed ## [8.5.2] - 2018-07-20 ### Fixed diff --git a/src/commands/diffWithWorking.ts b/src/commands/diffWithWorking.ts index e411c39..f023878 100644 --- a/src/commands/diffWithWorking.ts +++ b/src/commands/diffWithWorking.ts @@ -80,6 +80,8 @@ export class DiffWithWorkingCommand extends ActiveEditorCommand { const [workingFileName] = await Container.git.findWorkingFileName(gitUri.fsPath, gitUri.repoPath); if (workingFileName === undefined) return undefined; + args.commit.workingFileName = workingFileName; + const diffArgs: DiffWithCommandArgs = { repoPath: args.commit.repoPath, lhs: { @@ -88,7 +90,7 @@ export class DiffWithWorkingCommand extends ActiveEditorCommand { }, rhs: { sha: '', - uri: args.commit.uri + uri: args.commit.workingUri }, line: args.line, showOptions: args.showOptions diff --git a/src/git/models/commit.ts b/src/git/models/commit.ts index cdba351..b562db8 100644 --- a/src/git/models/commit.ts +++ b/src/git/models/commit.ts @@ -153,6 +153,10 @@ export abstract class GitCommit { return Uri.file(path.resolve(this.repoPath, this.fileName)); } + get workingUri(): Uri { + return this.workingFileName ? Uri.file(path.resolve(this.repoPath, this.workingFileName)) : this.uri; + } + private _dateFormatter?: Dates.IDateFormatter; formatDate(format?: string | null) {