Преглед изворни кода

Fixes #1218 - ahead/behind files uses merge base

main
Eric Amodio пре 4 година
родитељ
комит
1ba5f0584d
3 измењених фајлова са 11 додато и 4 уклоњено
  1. +1
    -0
      CHANGELOG.md
  2. +5
    -2
      src/views/nodes/compareBranchNode.ts
  3. +5
    -2
      src/views/nodes/compareResultsNode.ts

+ 1
- 0
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

+ 5
- 2
src/views/nodes/compareBranchNode.ts Прегледај датотеку

@ -69,6 +69,9 @@ export class CompareBranchNode extends ViewNode
const aheadBehindCounts = await Container.git.getAheadBehindCommitCount(this.branch.repoPath, [
GitRevision.createRange(behind.ref1, behind.ref2, '...'),
]);
const mergeBase = await Container.git.getMergeBase(this.branch.repoPath, behind.ref1, behind.ref2, {
forkPoint: true,
});
this._children = [
new ResultsCommitsNode(
@ -81,7 +84,7 @@ export class CompareBranchNode extends ViewNode
comparison: behind,
direction: 'behind',
files: {
ref1: this.compareWithWorkingTree ? '' : behind.ref1,
ref1: this.compareWithWorkingTree ? '' : mergeBase ?? behind.ref1,
ref2: behind.ref2,
query: this.getBehindFilesQuery.bind(this),
},
@ -104,7 +107,7 @@ export class CompareBranchNode extends ViewNode
comparison: ahead,
direction: 'ahead',
files: {
ref1: ahead.ref1,
ref1: mergeBase ?? ahead.ref1,
ref2: this.compareWithWorkingTree ? '' : ahead.ref2,
query: this.getAheadFilesQuery.bind(this),
},

+ 5
- 2
src/views/nodes/compareResultsNode.ts Прегледај датотеку

@ -77,6 +77,9 @@ export class CompareResultsNode 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),
},

Loading…
Откажи
Сачувај