mirror of
https://github.com/ckaczor/vscode-gitlens.git
synced 2026-01-16 09:35:40 -05:00
Changes previous diff to working diff if uncommit
This commit is contained in:
@@ -34,6 +34,13 @@ export default class DiffWithPreviousCommand extends EditorCommand {
|
||||
const gitUri = GitUri.fromUri(uri, this.git);
|
||||
|
||||
try {
|
||||
if (!gitUri.sha) {
|
||||
// If the file is uncommitted, treat it as a DiffWithWorking
|
||||
if (await this.git.isFileUncommitted(gitUri.fsPath, gitUri.repoPath)) {
|
||||
return commands.executeCommand(Commands.DiffWithWorking, uri);
|
||||
}
|
||||
}
|
||||
|
||||
const log = await this.git.getLogForFile(gitUri.fsPath, undefined, gitUri.repoPath, rangeOrLine as Range);
|
||||
if (!log) return window.showWarningMessage(`Unable to open diff. File is probably not under source control`);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user