Skip to content

Commit

Permalink
Limits default commits shown with multiple repos
Browse files Browse the repository at this point in the history
  • Loading branch information
eamodio committed Mar 10, 2021
1 parent 266608e commit e4fb006
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/views/commitsView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export class CommitsRepositoryNode extends RepositoryFolderNode<CommitsView, Bra

this.child = new BranchNode(this.uri, this.view, this, branch, true, {
expanded: true,
limitCommits: !this.splatted,
showComparison: this.view.config.showBranchComparison,
showCurrent: false,
showTracking: true,
Expand Down
9 changes: 8 additions & 1 deletion src/views/nodes/branchNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export class BranchNode
private _children: ViewNode[] | undefined;
private readonly options: {
expanded: boolean;
limitCommits: boolean;
showAsCommits: boolean;
showComparison: false | ViewShowBranchComparison;
showCurrent: boolean;
Expand All @@ -59,6 +60,7 @@ export class BranchNode

options?: {
expanded?: boolean;
limitCommits?: boolean;
showAsCommits?: boolean;
showComparison?: false | ViewShowBranchComparison;
showCurrent?: boolean;
Expand All @@ -71,6 +73,7 @@ export class BranchNode

this.options = {
expanded: false,
limitCommits: false,
showAsCommits: false,
showComparison: false,
// Hide the current branch checkmark when the node is displayed as a root
Expand Down Expand Up @@ -437,7 +440,11 @@ export class BranchNode
private _log: GitLog | undefined;
private async getLog() {
if (this._log == null) {
let limit = this.limit ?? (this.root ? this.view.config.pageItemLimit : this.view.config.defaultItemLimit);
let limit =
this.limit ??
(this.root && !this.options.limitCommits
? this.view.config.pageItemLimit
: this.view.config.defaultItemLimit);
// Try to show more commits if they are unpublished
if (limit !== 0 && this.branch.state.ahead > limit) {
limit = Math.min(this.branch.state.ahead + 1, limit * 2);
Expand Down

0 comments on commit e4fb006

Please sign in to comment.