Bladeren bron

Avoids setting more fn if not needed

main
Eric Amodio 2 jaren geleden
bovenliggende
commit
04600e8734
2 gewijzigde bestanden met toevoegingen van 31 en 18 verwijderingen
  1. +17
    -9
      src/env/node/git/localGitProvider.ts
  2. +14
    -9
      src/plus/github/githubGitProvider.ts

+ 17
- 9
src/env/node/git/localGitProvider.ts Bestand weergeven

@ -2395,7 +2395,7 @@ export class LocalGitProvider implements GitProvider, Disposable {
limit: moreLimit === 0 ? 0 : (options?.limit ?? 0) + moreLimit,
});
// If we can't find any more, assume we have everything
if (moreLog == null) return { ...log, hasMore: false };
if (moreLog == null) return { ...log, hasMore: false, more: undefined };
return moreLog;
}
@ -2418,7 +2418,7 @@ export class LocalGitProvider implements GitProvider, Disposable {
: { ref: moreUntil == null ? `${ref}^` : `${moreUntil}^..${ref}^` }),
});
// If we can't find any more, assume we have everything
if (moreLog == null) return { ...log, hasMore: false };
if (moreLog == null) return { ...log, hasMore: false, more: undefined };
const commits = new Map([...log.commits, ...moreLog.commits]);
@ -2441,7 +2441,9 @@ export class LocalGitProvider implements GitProvider, Disposable {
},
query: (limit: number | undefined) => this.getLog(log.repoPath, { ...options, limit: limit }),
};
mergedLog.more = this.getLogMoreFn(mergedLog, options);
if (mergedLog.hasMore) {
mergedLog.more = this.getLogMoreFn(mergedLog, options);
}
return mergedLog;
};
@ -2583,7 +2585,7 @@ export class LocalGitProvider implements GitProvider, Disposable {
skip: log.count,
});
// If we can't find any more, assume we have everything
if (moreLog == null) return { ...log, hasMore: false };
if (moreLog == null) return { ...log, hasMore: false, more: undefined };
const commits = new Map([...log.commits, ...moreLog.commits]);
@ -2598,7 +2600,9 @@ export class LocalGitProvider implements GitProvider, Disposable {
query: (limit: number | undefined) =>
this.getLogForSearch(log.repoPath, search, { ...options, limit: limit }),
};
mergedLog.more = this.getLogForSearchMoreFn(mergedLog, search, options);
if (mergedLog.hasMore) {
mergedLog.more = this.getLogForSearchMoreFn(mergedLog, search, options);
}
return mergedLog;
};
@ -2871,7 +2875,7 @@ export class LocalGitProvider implements GitProvider, Disposable {
skip: options.all ? log.count : undefined,
});
// If we can't find any more, assume we have everything
if (moreLog == null) return { ...log, hasMore: false };
if (moreLog == null) return { ...log, hasMore: false, more: undefined };
const commits = new Map([...log.commits, ...moreLog.commits]);
@ -2895,7 +2899,9 @@ export class LocalGitProvider implements GitProvider, Disposable {
relativePath = renamed?.file?.originalPath ?? relativePath;
}
mergedLog.more = this.getLogForFileMoreFn(mergedLog, relativePath, options);
if (mergedLog.hasMore) {
mergedLog.more = this.getLogForFileMoreFn(mergedLog, relativePath, options);
}
return mergedLog;
};
@ -3442,7 +3448,7 @@ export class LocalGitProvider implements GitProvider, Disposable {
});
if (moreLog == null) {
// If we can't find any more, assume we have everything
return { ...reflog, hasMore: false };
return { ...reflog, hasMore: false, more: undefined };
}
const mergedLog: GitReflog = {
@ -3453,7 +3459,9 @@ export class LocalGitProvider implements GitProvider, Disposable {
limit: (reflog.limit ?? 0) + limit,
hasMore: moreLog.hasMore,
};
mergedLog.more = this.getReflogMoreFn(mergedLog, options);
if (mergedLog.hasMore) {
mergedLog.more = this.getReflogMoreFn(mergedLog, options);
}
return mergedLog;
};

+ 14
- 9
src/plus/github/githubGitProvider.ts Bestand weergeven

@ -1471,7 +1471,7 @@ export class GitHubGitProvider implements GitProvider, Disposable {
// limit: moreLimit === 0 ? 0 : (options?.limit ?? 0) + moreLimit,
// });
// // If we can't find any more, assume we have everything
// if (moreLog == null) return { ...log, hasMore: false };
// if (moreLog == null) return { ...log, hasMore: false, more: undefined };
// return moreLog;
// }
@ -1483,7 +1483,7 @@ export class GitHubGitProvider implements GitProvider, Disposable {
// ref: moreUntil == null ? `${ref}^` : `${moreUntil}^..${ref}^`,
// });
// // If we can't find any more, assume we have everything
// if (moreLog == null) return { ...log, hasMore: false };
// if (moreLog == null) return { ...log, hasMore: false, more: undefined };
const moreLog = await this.getLog(log.repoPath, {
...options,
@ -1491,7 +1491,7 @@ export class GitHubGitProvider implements GitProvider, Disposable {
cursor: log.endingCursor,
});
// If we can't find any more, assume we have everything
if (moreLog == null) return { ...log, hasMore: false };
if (moreLog == null) return { ...log, hasMore: false, more: undefined };
const commits = new Map([...log.commits, ...moreLog.commits]);
@ -1514,7 +1514,9 @@ export class GitHubGitProvider implements GitProvider, Disposable {
},
query: log.query,
};
mergedLog.more = this.getLogMoreFn(mergedLog, options);
if (mergedLog.hasMore) {
mergedLog.more = this.getLogMoreFn(mergedLog, options);
}
return mergedLog;
};
@ -1688,7 +1690,7 @@ export class GitHubGitProvider implements GitProvider, Disposable {
cursor: log.endingCursor,
});
// If we can't find any more, assume we have everything
if (moreLog == null) return { ...log, hasMore: false };
if (moreLog == null) return { ...log, hasMore: false, more: undefined };
const commits = new Map([...log.commits, ...moreLog.commits]);
@ -1703,7 +1705,9 @@ export class GitHubGitProvider implements GitProvider, Disposable {
endingCursor: moreLog.endingCursor,
query: log.query,
};
mergedLog.more = this.getLogForSearchMoreFn(mergedLog, search, options);
if (mergedLog.hasMore) {
mergedLog.more = this.getLogForSearchMoreFn(mergedLog, search, options);
}
return mergedLog;
};
@ -1984,7 +1988,6 @@ export class GitHubGitProvider implements GitProvider, Disposable {
endingCursor: result.paging?.cursor,
query: (limit: number | undefined) => this.getLogForFile(repoPath, path, { ...options, limit: limit }),
};
if (log.hasMore) {
log.more = this.getLogForFileMoreFn(log, path, options);
}
@ -2042,7 +2045,7 @@ export class GitHubGitProvider implements GitProvider, Disposable {
// skip: options.all ? log.count : undefined,
});
// If we can't find any more, assume we have everything
if (moreLog == null) return { ...log, hasMore: false };
if (moreLog == null) return { ...log, hasMore: false, more: undefined };
const commits = new Map([...log.commits, ...moreLog.commits]);
@ -2066,7 +2069,9 @@ export class GitHubGitProvider implements GitProvider, Disposable {
// fileName = renamed?.file?.originalPath ?? fileName;
// }
mergedLog.more = this.getLogForFileMoreFn(mergedLog, relativePath, options);
if (mergedLog.hasMore) {
mergedLog.more = this.getLogForFileMoreFn(mergedLog, relativePath, options);
}
return mergedLog;
};

Laden…
Annuleren
Opslaan