mirror of
https://github.com/ckaczor/vscode-gitlens.git
synced 2026-01-21 01:35:37 -05:00
Changes file alt+right to be a diff on commit details quick pick
Changes file alt+right to be a diff on repo status quick pick
This commit is contained in:
@@ -3,6 +3,7 @@ import { Iterables } from '../system';
|
||||
import { commands, Range, TextDocumentShowOptions, TextEditor, Uri, window } from 'vscode';
|
||||
import { ActiveEditorCommand, Commands, getCommandUri } from './common';
|
||||
import { BuiltInCommands } from '../constants';
|
||||
import { DiffWithWorkingCommandArgs } from './diffWithWorking';
|
||||
import { GitCommit, GitService, GitUri } from '../gitService';
|
||||
import { Logger } from '../logger';
|
||||
import * as moment from 'moment';
|
||||
@@ -27,13 +28,13 @@ export class DiffWithPreviousCommand extends ActiveEditorCommand {
|
||||
|
||||
args.line = args.line || (editor === undefined ? 0 : editor.selection.active.line);
|
||||
|
||||
if (args.commit === undefined || args.range !== undefined) {
|
||||
if (args.commit === undefined || (args.commit.type !== 'file') || args.range !== undefined) {
|
||||
const gitUri = await GitUri.fromUri(uri, this.git);
|
||||
|
||||
try {
|
||||
// If the sha is missing or the file is uncommitted, treat it as a DiffWithWorking
|
||||
if (gitUri.sha === undefined && await this.git.isFileUncommitted(gitUri)) {
|
||||
return commands.executeCommand(Commands.DiffWithWorking, uri);
|
||||
return commands.executeCommand(Commands.DiffWithWorking, uri, { showOptions: args.showOptions } as DiffWithWorkingCommandArgs);
|
||||
}
|
||||
|
||||
const sha = args.commit === undefined ? gitUri.sha : args.commit.sha;
|
||||
|
||||
Reference in New Issue
Block a user