瀏覽代碼

Fixes #812 - diffWithPrev with uncommitted changes

main
Eric Amodio 5 年之前
父節點
當前提交
4fedcd8fae
共有 2 個檔案被更改,包括 28 行新增15 行删除
  1. +6
    -0
      CHANGELOG.md
  2. +22
    -15
      src/commands/diffWithPrevious.ts

+ 6
- 0
CHANGELOG.md 查看文件

@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/).
## [Unreleased]
### Fixed
- 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
## [9.9.2] - 2019-08-01
### Added

+ 22
- 15
src/commands/diffWithPrevious.ts 查看文件

@ -50,24 +50,31 @@ export class DiffWithPreviousCommand extends ActiveEditorCommand {
args.line = editor == null ? 0 : editor.selection.active.line;
}
let gitUri;
if (args.commit !== undefined) {
const diffArgs: DiffWithCommandArgs = {
repoPath: args.commit.repoPath,
lhs: {
sha: `${args.commit.sha}^`,
uri: args.commit.originalUri
},
rhs: {
sha: args.commit.sha || '',
uri: args.commit.uri
},
line: args.line,
showOptions: args.showOptions
};
return commands.executeCommand(Commands.DiffWith, diffArgs);
if (!args.commit.isUncommitted) {
const diffArgs: DiffWithCommandArgs = {
repoPath: args.commit.repoPath,
lhs: {
sha: `${args.commit.sha}^`,
uri: args.commit.originalUri
},
rhs: {
sha: args.commit.sha || '',
uri: args.commit.uri
},
line: args.line,
showOptions: args.showOptions
};
return commands.executeCommand(Commands.DiffWith, diffArgs);
}
gitUri = GitUri.fromCommit(args.commit);
}
else {
gitUri = await GitUri.fromUri(uri);
}
const gitUri = await GitUri.fromUri(uri);
try {
const diffUris = await Container.git.getPreviousDiffUris(
gitUri.repoPath!,

Loading…
取消
儲存