Browse Source

Falls back to std merge-base if --fork-point fails

main
Eric Amodio 4 years ago
parent
commit
2034e8eef1
3 changed files with 7 additions and 7 deletions
  1. +1
    -1
      src/git/gitService.ts
  2. +3
    -3
      src/views/nodes/compareBranchNode.ts
  3. +3
    -3
      src/views/nodes/compareResultsNode.ts

+ 1
- 1
src/git/gitService.ts View File

@ -2334,7 +2334,7 @@ export class GitService implements Disposable {
const data = await Git.merge_base(repoPath, ref1, ref2, options);
if (data == null) return undefined;
return data.split('\n')[0];
return data.split('\n')[0].trim() || undefined;
} catch (ex) {
Logger.error(ex, cc);
return undefined;

+ 3
- 3
src/views/nodes/compareBranchNode.ts View File

@ -72,9 +72,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,
});
const mergeBase =
(await Container.git.getMergeBase(this.repoPath, behind.ref1, behind.ref2, { forkPoint: true })) ??
(await Container.git.getMergeBase(this.repoPath, behind.ref1, behind.ref2));
this._children = [
new ResultsCommitsNode(

+ 3
- 3
src/views/nodes/compareResultsNode.ts View File

@ -77,9 +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,
});
const mergeBase =
(await Container.git.getMergeBase(this.repoPath, behind.ref1, behind.ref2, { forkPoint: true })) ??
(await Container.git.getMergeBase(this.repoPath, behind.ref1, behind.ref2));
this._children = [
new ResultsCommitsNode(

Loading…
Cancel
Save