Fixes #84 - diff w/ previous should only compare w/ working tree if file is uncommitted

This commit is contained in:
Eric Amodio
2017-06-09 10:45:04 -04:00
parent 62e5ef6225
commit 50ba3e1446
2 changed files with 4 additions and 4 deletions

View File

@@ -37,7 +37,7 @@ export class DiffWithNextCommand extends ActiveEditorCommand {
const sha = args.commit === undefined ? gitUri.sha : args.commit.sha;
const log = await this.git.getLogForFile(gitUri.repoPath, gitUri.fsPath, undefined, sha ? undefined : 2, args.range!);
const log = await this.git.getLogForFile(gitUri.repoPath, gitUri.fsPath, undefined, sha !== undefined ? undefined : 2, args.range!);
if (log === undefined) return window.showWarningMessage(`Unable to open compare. File is probably not under source control`);
args.commit = (sha && log.commits.get(sha)) || Iterables.first(log.commits.values());