Pārlūkot izejas kodu

Removes duplication

main
Eric Amodio pirms 4 gadiem
vecāks
revīzija
dc510aa967
1 mainītis faili ar 11 papildinājumiem un 17 dzēšanām
  1. +11
    -17
      src/views/nodes/branchTrackingStatusNode.ts

+ 11
- 17
src/views/nodes/branchTrackingStatusNode.ts Parādīt failu

@ -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]));
}

Notiek ielāde…
Atcelt
Saglabāt