Ver código fonte

Fixes #806 - use merge base with .. compares

main
Eric Amodio 5 anos atrás
pai
commit
0f5c4abe79
3 arquivos alterados com 15 adições e 4 exclusões
  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 Ver arquivo

@ -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 Ver arquivo

@ -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 Ver arquivo

@ -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)
)

Carregando…
Cancelar
Salvar