Avoids re-setting the line if it is already set

This commit is contained in:
Eric Amodio
2017-06-27 01:18:15 -04:00
parent 93ea2c7145
commit 9179b70875
3 changed files with 9 additions and 3 deletions

View File

@@ -25,7 +25,9 @@ export class DiffWithBranchCommand extends ActiveEditorCommand {
uri = getCommandUri(uri, editor);
if (uri === undefined) return undefined;
args.line = args.line || (editor === undefined ? 0 : editor.selection.active.line);
if (args.line === undefined) {
args.line = editor === undefined ? 0 : editor.selection.active.line;
}
const gitUri = await GitUri.fromUri(uri, this.git);
if (!gitUri.repoPath) return Messages.showNoRepositoryWarningMessage(`Unable to open branch compare`);

View File

@@ -25,7 +25,9 @@ export class DiffWithNextCommand extends ActiveEditorCommand {
uri = getCommandUri(uri, editor);
if (uri === undefined) return undefined;
args.line = args.line || (editor === undefined ? 0 : editor.selection.active.line);
if (args.line === undefined) {
args.line = editor === undefined ? 0 : editor.selection.active.line;
}
if (args.commit === undefined || !(args.commit instanceof GitLogCommit) || args.range !== undefined) {
const gitUri = await GitUri.fromUri(uri, this.git);

View File

@@ -23,7 +23,9 @@ export class DiffWithWorkingCommand extends ActiveEditorCommand {
uri = getCommandUri(uri, editor);
if (uri === undefined) return undefined;
args.line = args.line || (editor === undefined ? 0 : editor.selection.active.line);
if (args.line === undefined) {
args.line = editor === undefined ? 0 : editor.selection.active.line;
}
if (args.commit === undefined || GitService.isUncommitted(args.commit.sha)) {
const gitUri = await GitUri.fromUri(uri, this.git);