Browse Source

Removes duplication

main
Eric Amodio 4 years ago
parent
commit
dc510aa967
1 changed files with 11 additions and 17 deletions
  1. +11
    -17
      src/views/nodes/branchTrackingStatusNode.ts

+ 11
- 17
src/views/nodes/branchTrackingStatusNode.ts View File

@ -64,10 +64,10 @@ export class BranchTrackingStatusNode extends ViewNode implement
const log = await this.getLog();
if (log == null) return [];
let children;
let commits;
if (this.upstreamType === 'ahead') {
// Since the last commit when we are looking 'ahead' can have no previous (because of the range given) -- look it up
const commits = [...log.commits.values()];
commits = [...log.commits.values()];
const commit = commits[commits.length - 1];
if (commit.previousSha == null) {
const previousLog = await Container.git.getLog(this.uri.repoPath!, { limit: 2, ref: commit.sha });
@ -75,24 +75,18 @@ export class BranchTrackingStatusNode extends ViewNode implement
commits[commits.length - 1] = Iterables.first(previousLog.commits.values());
}
}
children = [
...insertDateMarkers(
Iterables.map(commits, c => new CommitNode(this.view, this, c, this.branch)),
this,
1,
),
];
} else {
children = [
...insertDateMarkers(
Iterables.map(log.commits.values(), c => new CommitNode(this.view, this, c, this.branch)),
this,
1,
),
];
commits = log.commits.values();
}
const children = [
...insertDateMarkers(
Iterables.map(commits, c => new CommitNode(this.view, this, c, this.branch)),
this,
1,
),
];
if (log.hasMore) {
children.push(new LoadMoreNode(this.view, this, children[children.length - 1]));
}

Loading…
Cancel
Save