Browse Source

Ensures proper log limit

main
Eric Amodio 2 years ago
parent
commit
8e00e0171b
2 changed files with 14 additions and 6 deletions
  1. +1
    -1
      src/env/node/git/localGitProvider.ts
  2. +13
    -5
      src/premium/github/githubGitProvider.ts

+ 1
- 1
src/env/node/git/localGitProvider.ts View File

@ -2295,7 +2295,7 @@ export class LocalGitProvider implements GitProvider, Disposable {
key += ':all';
}
options.limit = options.limit == null ? this.container.config.advanced.maxListItems || 0 : options.limit;
options.limit = options.limit ?? this.container.config.advanced.maxListItems ?? 0;
if (options.limit) {
key += `:n${options.limit}`;
}

+ 13
- 5
src/premium/github/githubGitProvider.ts View File

@ -1152,7 +1152,7 @@ export class GitHubGitProvider implements GitProvider, Disposable {
const cc = Logger.getCorrelationContext();
const limit = options?.limit ?? this.container.config.advanced.maxListItems ?? 0;
const limit = this.getPagingLimit(options?.limit);
try {
const { metadata, github, session } = await this.ensureRepositoryContext(repoPath);
@ -1288,7 +1288,7 @@ export class GitHubGitProvider implements GitProvider, Disposable {
return log;
}
moreLimit = moreLimit ?? this.container.config.advanced.maxSearchItems ?? 0;
moreLimit = this.getPagingLimit(moreLimit);
// // If the log is for a range, then just get everything prior + more
// if (GitRevision.isRange(log.sha)) {
@ -1418,7 +1418,7 @@ export class GitHubGitProvider implements GitProvider, Disposable {
// key += ':all';
// }
options.limit = options.limit == null ? this.container.config.advanced.maxListItems || 0 : options.limit;
options.limit = this.getPagingLimit(options?.limit);
if (options.limit) {
key += `:n${options.limit}`;
}
@ -1548,7 +1548,7 @@ export class GitHubGitProvider implements GitProvider, Disposable {
): Promise<GitLog | undefined> {
if (repoPath == null) return undefined;
const limit = options?.limit ?? this.container.config.advanced.maxListItems ?? 0;
const limit = this.getPagingLimit(options?.limit);
try {
const context = await this.ensureRepositoryContext(repoPath);
@ -1691,7 +1691,7 @@ export class GitHubGitProvider implements GitProvider, Disposable {
return log;
}
moreLimit = moreLimit ?? this.container.config.advanced.maxSearchItems ?? 0;
moreLimit = this.getPagingLimit(moreLimit);
// const ref = Iterables.last(log.commits.values())?.ref;
const moreLog = await this.getLogForFile(log.repoPath, relativePath, {
@ -2430,6 +2430,14 @@ export class GitHubGitProvider implements GitProvider, Disposable {
return this._remotehub.getProviderUri(uri);
}
private getPagingLimit(limit?: number): number {
limit = Math.min(100, limit ?? this.container.config.advanced.maxListItems ?? 100);
if (limit === 0) {
limit = 100;
}
return limit;
}
private async resolveReferenceCore(
repoPath: string,
metadata: Metadata,

Loading…
Cancel
Save