From 71cfcbc7c012612b84a2c9f6a595580557c843ad Mon Sep 17 00:00:00 2001 From: Eric Amodio Date: Tue, 3 Sep 2019 03:05:03 -0400 Subject: [PATCH] Fixes #821 - wrong order of Compare * With cmds --- CHANGELOG.md | 1 + src/commands/diffBranchWith.ts | 18 +++++++++--------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ee4d392..1e6d012 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -49,6 +49,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p ### Fixed +- Fixes [#821](https://github.com/eamodio/vscode-gitlens/issues/821) - Wrong comparison order in the Compare view when using Compare [HEAD|Working Tree] With comands - Fixes [#828](https://github.com/eamodio/vscode-gitlens/issues/828) - Version comparison to show welcome message is not future proof — thanks to [PR #829](https://github.com/eamodio/vscode-gitlens/pull/829) by Arunprasad Rajkumar ([@arajkumar](https://github.com/arajkumar)) - Fixes typo of "workbench.colorCustomization" in README — thanks to [PR #823](https://github.com/eamodio/vscode-gitlens/pull/823) by Kwok ([@mankwok](https://github.com/mankwok)) - Fixes [#738](https://github.com/eamodio/vscode-gitlens/issues/738) - Disable showWhatsNewAfterUpgrades notification diff --git a/src/commands/diffBranchWith.ts b/src/commands/diffBranchWith.ts index 7588411..fcc47b4 100644 --- a/src/commands/diffBranchWith.ts +++ b/src/commands/diffBranchWith.ts @@ -34,12 +34,12 @@ export class DiffBranchWithCommand extends ActiveEditorCommand { switch (context.command) { case Commands.DiffHeadWith: case Commands.DiffHeadWithBranch: - args.ref2 = 'HEAD'; + args.ref1 = 'HEAD'; break; case Commands.DiffWorkingWith: case Commands.DiffWorkingWithBranch: - args.ref2 = ''; + args.ref1 = ''; break; } @@ -47,7 +47,7 @@ export class DiffBranchWithCommand extends ActiveEditorCommand { } async execute(editor?: TextEditor, uri?: Uri, args: DiffBranchWithCommandArgs = {}) { - if (args.ref2 === undefined) return undefined; + if (args.ref1 === undefined) return undefined; uri = getCommandUri(uri, editor); @@ -59,10 +59,10 @@ export class DiffBranchWithCommand extends ActiveEditorCommand { ); if (!repoPath) return undefined; - if (!args.ref1) { + if (!args.ref2) { let checkmarks; let placeHolder; - switch (args.ref2) { + switch (args.ref1) { case '': checkmarks = false; placeHolder = `Compare Working Tree with${GlyphChars.Ellipsis}`; @@ -73,21 +73,21 @@ export class DiffBranchWithCommand extends ActiveEditorCommand { break; default: checkmarks = true; - placeHolder = `Compare ${args.ref2} with${GlyphChars.Ellipsis}`; + placeHolder = `Compare ${args.ref1} with${GlyphChars.Ellipsis}`; break; } const pick = await new ReferencesQuickPick(repoPath).show(placeHolder, { allowEnteringRefs: true, - checked: args.ref2, + checked: args.ref1, checkmarks: checkmarks }); if (pick === undefined) return undefined; if (pick instanceof CommandQuickPickItem) return pick.execute(); - args.ref1 = pick.ref; - if (args.ref1 === undefined) return undefined; + args.ref2 = pick.ref; + if (args.ref2 === undefined) return undefined; } await Container.compareView.compare(repoPath, args.ref1, args.ref2);