Skip to content

Commit 6e5a82e

Browse files
committed
Fixes issue showing changes with working with renamed files
1 parent 93f2be5 commit 6e5a82e

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
88
### Fixed
99
- Fixes [#454](https://github.com/eamodio/vscode-gitlens/issues/454) - Search for string returns merge commits (unlike raw `git log -S`)
1010
- Fixes issue showing changes with untracked stashed files
11+
- Fixes issue showing changes with working file when the file has been renamed
1112

1213
## [8.5.2] - 2018-07-20
1314
### Fixed

src/commands/diffWithWorking.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ export class DiffWithWorkingCommand extends ActiveEditorCommand {
8080
const [workingFileName] = await Container.git.findWorkingFileName(gitUri.fsPath, gitUri.repoPath);
8181
if (workingFileName === undefined) return undefined;
8282

83+
args.commit.workingFileName = workingFileName;
84+
8385
const diffArgs: DiffWithCommandArgs = {
8486
repoPath: args.commit.repoPath,
8587
lhs: {
@@ -88,7 +90,7 @@ export class DiffWithWorkingCommand extends ActiveEditorCommand {
8890
},
8991
rhs: {
9092
sha: '',
91-
uri: args.commit.uri
93+
uri: args.commit.workingUri
9294
},
9395
line: args.line,
9496
showOptions: args.showOptions

src/git/models/commit.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,10 @@ export abstract class GitCommit {
153153
return Uri.file(path.resolve(this.repoPath, this.fileName));
154154
}
155155

156+
get workingUri(): Uri {
157+
return this.workingFileName ? Uri.file(path.resolve(this.repoPath, this.workingFileName)) : this.uri;
158+
}
159+
156160
private _dateFormatter?: Dates.IDateFormatter;
157161

158162
formatDate(format?: string | null) {

0 commit comments

Comments
 (0)