Browse Source

Fixes #806 - use merge base with .. compares

main
Eric Amodio 5 years ago
parent
commit
0f5c4abe79
3 changed files with 15 additions and 4 deletions
  1. +1
    -0
      CHANGELOG.md
  2. +7
    -2
      src/views/nodes/compareBranchNode.ts
  3. +7
    -2
      src/views/nodes/compareResultsNode.ts

+ 1
- 0
CHANGELOG.md View File

@ -8,6 +8,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
### Fixed
- Fixes [#806](https://github.com/eamodio/vscode-gitlens/issues/806) - file diff in two-dot branch compare should only show the changes in one branch
- Fixes [#756](https://github.com/eamodio/vscode-gitlens/issues/756) - Merge commit shows only the changes from the last commit on those files
- Fixes [#809](https://github.com/eamodio/vscode-gitlens/issues/809) - Wrong commit diff in file history
- Fixes [#685](https://github.com/eamodio/vscode-gitlens/issues/685) - GitLens not loading for a single repository

+ 7
- 2
src/views/nodes/compareBranchNode.ts View File

@ -36,10 +36,15 @@ export class CompareBranchNode extends ViewNode {
return `gitlens:repository(${this.branch.repoPath}):compare:branch(${this.branch.name}):compareWith`;
}
getChildren(): ViewNode[] {
async getChildren(): Promise<ViewNode[]> {
if (this._compareWith === undefined) return [];
if (this._children === undefined) {
let ref1 = (this._compareWith && this._compareWith.ref) || 'HEAD';
if (this.comparisonNotation === '..') {
ref1 = (await Container.git.getMergeBase(this.branch.repoPath, ref1, this.branch.ref)) || ref1;
}
this._children = [
new ResultsCommitsNode(
this.view,
@ -56,7 +61,7 @@ export class CompareBranchNode extends ViewNode {
this.view,
this,
this.uri.repoPath!,
(this._compareWith && this._compareWith.ref) || ">'HEAD',
ref1,
this.compareWithWorkingTree ? '' : this.branch.ref,
this.getFilesQuery.bind(this)
)

+ 7
- 2
src/views/nodes/compareResultsNode.ts View File

@ -49,8 +49,13 @@ export class CompareResultsNode extends SubscribeableViewNode {
return this._ref2;
}
getChildren(): ViewNode[] {
async getChildren(): Promise<ViewNode[]> {
if (this._children === undefined) {
let ref1 = this._ref1.ref;
if (this.comparisonNotation === '..') {
ref1 = (await Container.git.getMergeBase(this.repoPath, ref1, this._ref2.ref)) || ref1;
}
this._children = [
new ResultsCommitsNode(
this.view,
@ -67,7 +72,7 @@ export class CompareResultsNode extends SubscribeableViewNode {
this.view,
this,
this.uri.repoPath!,
this._ref1.ref,
ref1,
this._ref2.ref,
this.getFilesQuery.bind(this)
)

Loading…
Cancel
Save