From 9e1375e87327929b415040c4a19440255e7f401f Mon Sep 17 00:00:00 2001 From: Eric Amodio Date: Sun, 23 May 2021 16:47:02 -0400 Subject: [PATCH] Fixes #1498: Saved compares dont restore properly --- CHANGELOG.md | 1 + src/views/nodes/compareResultsNode.ts | 4 ++-- src/views/searchAndCompareView.ts | 9 ++++++++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f9025ac..1ffa66a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p ### Fixed +- Fixes [#1498](https://github.com/eamodio/vscode-gitlens/issues/1498) - "Search & Compare" broken entries - Fixes [#1507](https://github.com/eamodio/vscode-gitlens/issues/1507) - Communicate git error instead of "unable to find git" - Fixes [#1512](https://github.com/eamodio/vscode-gitlens/issues/1512) - Git tag command can add an extra `-m` - Fixes [#1402](https://github.com/eamodio/vscode-gitlens/issues/1402) - File history missing commits from other branches diff --git a/src/views/nodes/compareResultsNode.ts b/src/views/nodes/compareResultsNode.ts index c7cd16e..cdf8d9c 100644 --- a/src/views/nodes/compareResultsNode.ts +++ b/src/views/nodes/compareResultsNode.ts @@ -331,8 +331,8 @@ export class CompareResultsNode extends ViewNode { type: 'comparison', timestamp: this._pinned, path: this.repoPath, - ref1: this._ref, - ref2: this._compareWith, + ref1: { label: this._ref.label, ref: this._ref.ref }, + ref2: { label: this._compareWith.label, ref: this._compareWith.ref }, }); } } diff --git a/src/views/searchAndCompareView.ts b/src/views/searchAndCompareView.ts index 987dd00..488bb30 100644 --- a/src/views/searchAndCompareView.ts +++ b/src/views/searchAndCompareView.ts @@ -447,7 +447,14 @@ export class SearchAndCompareView extends ViewBase (b.timestamp ?? 0) - (a.timestamp ?? 0)) .map(p => p.type === 'comparison' - ? new CompareResultsNode(this, root, p.path, p.ref1, p.ref2, p.timestamp) + ? new CompareResultsNode( + this, + root, + p.path, + { label: p.ref1.label, ref: p.ref1.ref ?? (p.ref1 as any).name ?? (p.ref1 as any).sha }, + { label: p.ref2.label, ref: p.ref2.ref ?? (p.ref2 as any).name ?? (p.ref2 as any).sha }, + p.timestamp, + ) : new SearchResultsNode(this, root, p.path, p.search, p.labels, undefined, p.timestamp), ); }