From 53c691898f72c1df556d2eb6648d6637cfddd106 Mon Sep 17 00:00:00 2001 From: Eric Amodio Date: Sat, 27 May 2017 04:26:51 -0400 Subject: [PATCH] Changes behavior of diffWithWorking to always does what it says Compares the current file with the working tree -- if the current file *is* the working file, it will show a `File matches the working tree` message --- src/commands/diffWithWorking.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/commands/diffWithWorking.ts b/src/commands/diffWithWorking.ts index e2d60e7..629f0eb 100644 --- a/src/commands/diffWithWorking.ts +++ b/src/commands/diffWithWorking.ts @@ -26,6 +26,8 @@ export class DiffWithWorkingCommand extends ActiveEditorCommand { if (args.commit === undefined || GitService.isUncommitted(args.commit.sha)) { const gitUri = await GitUri.fromUri(uri, this.git); + // If the sha is missing, just let the user know the file matches + if (gitUri.sha === undefined) return window.showInformationMessage(`File matches the working tree`); try { args.commit = await this.git.getLogCommit(gitUri.repoPath, gitUri.fsPath, gitUri.sha, { firstIfMissing: true });