Skip to content

Commit 4fedcd8

Browse files
committed
Fixes #812 - diffWithPrev with uncommitted changes
1 parent 7d2e642 commit 4fedcd8

File tree

2 files changed

+28
-15
lines changed

2 files changed

+28
-15
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
44

55
The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/).
66

7+
## [Unreleased]
8+
9+
### Fixed
10+
11+
- Fixes [#812](https://github.com/eamodio/vscode-gitlens/issues/812) - Regression in 9.9.2: Clicking changed file in Repository Browser opens diff view between WorkingTree <-> WorkingTree, not index
12+
713
## [9.9.2] - 2019-08-01
814

915
### Added

src/commands/diffWithPrevious.ts

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -50,24 +50,31 @@ export class DiffWithPreviousCommand extends ActiveEditorCommand {
5050
args.line = editor == null ? 0 : editor.selection.active.line;
5151
}
5252

53+
let gitUri;
5354
if (args.commit !== undefined) {
54-
const diffArgs: DiffWithCommandArgs = {
55-
repoPath: args.commit.repoPath,
56-
lhs: {
57-
sha: `${args.commit.sha}^`,
58-
uri: args.commit.originalUri
59-
},
60-
rhs: {
61-
sha: args.commit.sha || '',
62-
uri: args.commit.uri
63-
},
64-
line: args.line,
65-
showOptions: args.showOptions
66-
};
67-
return commands.executeCommand(Commands.DiffWith, diffArgs);
55+
if (!args.commit.isUncommitted) {
56+
const diffArgs: DiffWithCommandArgs = {
57+
repoPath: args.commit.repoPath,
58+
lhs: {
59+
sha: `${args.commit.sha}^`,
60+
uri: args.commit.originalUri
61+
},
62+
rhs: {
63+
sha: args.commit.sha || '',
64+
uri: args.commit.uri
65+
},
66+
line: args.line,
67+
showOptions: args.showOptions
68+
};
69+
return commands.executeCommand(Commands.DiffWith, diffArgs);
70+
}
71+
72+
gitUri = GitUri.fromCommit(args.commit);
73+
}
74+
else {
75+
gitUri = await GitUri.fromUri(uri);
6876
}
6977

70-
const gitUri = await GitUri.fromUri(uri);
7178
try {
7279
const diffUris = await Container.git.getPreviousDiffUris(
7380
gitUri.repoPath!,

0 commit comments

Comments
 (0)