diff --git a/CHANGELOG.md b/CHANGELOG.md index 1d93609..c568e4b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,6 +32,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p ### Fixed +- Fixes [#1218](https://github.com/eamodio/vscode-gitlens/issues/1218) - Opening Ahead/Behind files isn't showing the desire diff (e.g. diff with the merge base) - Fixes [#1255](https://github.com/eamodio/vscode-gitlens/issues/1255) - Repository folders are missing repository actions (e.g. favorites, close repo, etc) - Fixes [#1246](https://github.com/eamodio/vscode-gitlens/issues/1246) - Gutter Blame avatar does not use Gravatar fallback style - Fixes [#1208](https://github.com/eamodio/vscode-gitlens/issues/1208) - Connect to Github notification is noisy diff --git a/src/views/nodes/compareBranchNode.ts b/src/views/nodes/compareBranchNode.ts index c556ae0..ef1c318 100644 --- a/src/views/nodes/compareBranchNode.ts +++ b/src/views/nodes/compareBranchNode.ts @@ -69,6 +69,9 @@ export class CompareBranchNode extends ViewNode { const aheadBehindCounts = await Container.git.getAheadBehindCommitCount(this.repoPath, [ GitRevision.createRange(behind.ref1 || 'HEAD', behind.ref2, '...'), ]); + const mergeBase = await Container.git.getMergeBase(this.repoPath, behind.ref1, behind.ref2, { + forkPoint: true, + }); this._children = [ new ResultsCommitsNode( @@ -89,7 +92,7 @@ export class CompareResultsNode extends ViewNode { comparison: behind, direction: 'behind', files: { - ref1: behind.ref1, + ref1: behind.ref1 === '' ? '' : mergeBase ?? behind.ref1, ref2: behind.ref2, query: this.getBehindFilesQuery.bind(this), }, @@ -110,7 +113,7 @@ export class CompareResultsNode extends ViewNode { comparison: ahead, direction: 'ahead', files: { - ref1: ahead.ref1, + ref1: mergeBase ?? ahead.ref1, ref2: ahead.ref2, query: this.getAheadFilesQuery.bind(this), },