mirror of
https://github.com/jesseduffield/lazygit.git
synced 2026-11-06 13:00:59 -04:00
Pass the number of commits to load to the commit loader
The commit loader took a flag for whether to limit the number of commits it loads, and the limit of 300 was hard-coded in it. A later commit needs to load more than that while bisecting, so let the caller pass the number. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
b2e9d2a348
commit
0d41e696ac
@@ -56,7 +56,7 @@ func NewCommitLoader(
|
||||
}
|
||||
|
||||
type GetCommitsOptions struct {
|
||||
Limit bool
|
||||
Limit int // the maximum number of commits to load, or 0 to load all of them
|
||||
FilterPath string
|
||||
FilterAuthor string
|
||||
IncludeRebaseCommits bool
|
||||
@@ -611,7 +611,7 @@ func (self *CommitLoader) getLogCmd(opts GetCommitsOptions) *oscommands.CmdObj {
|
||||
Arg(prettyFormat).
|
||||
Arg("--abbrev=40").
|
||||
ArgIf(opts.FilterAuthor != "", "--author="+opts.FilterAuthor).
|
||||
ArgIf(opts.Limit, "-300").
|
||||
ArgIf(opts.Limit > 0, fmt.Sprintf("-%d", opts.Limit)).
|
||||
ArgIf(opts.FilterPath != "", "--follow", "--name-status").
|
||||
Arg("--no-show-signature").
|
||||
ArgIf(opts.RefToShowDivergenceFrom != "", "--left-right").
|
||||
|
||||
@@ -758,6 +758,10 @@ func (self *RefreshHelper) refreshReflogAndBranches(capturedReflog capturedReflo
|
||||
return nil
|
||||
}
|
||||
|
||||
// The number of commits that the commits and sub-commits views load at first,
|
||||
// to keep things fast. They load the rest when the user scrolls near the end.
|
||||
const commitLimit = 300
|
||||
|
||||
// capturedCommitState holds everything the commits refresh reads from the
|
||||
// model, contexts, and modes. It is gathered on the UI thread (see
|
||||
// captureCommitsState) before the git work is dispatched to a worker, so the
|
||||
@@ -852,7 +856,7 @@ func (self *RefreshHelper) refreshCommitsWithLimit(captured capturedCommitState,
|
||||
refName, bisectInfo := self.refForLog(env)
|
||||
commits, err := env.git.Loaders.CommitLoader.GetCommits(
|
||||
git_commands.GetCommitsOptions{
|
||||
Limit: captured.limitCommits,
|
||||
Limit: lo.Ternary(captured.limitCommits, commitLimit, 0),
|
||||
FilterPath: captured.filterPath,
|
||||
FilterAuthor: captured.filterAuthor,
|
||||
IncludeRebaseCommits: true,
|
||||
@@ -1073,7 +1077,7 @@ func (self *RefreshHelper) refreshSubCommitsWithLimit(captured capturedSubCommit
|
||||
|
||||
commits, err := env.git.Loaders.CommitLoader.GetCommits(
|
||||
git_commands.GetCommitsOptions{
|
||||
Limit: captured.limitCommits,
|
||||
Limit: lo.Ternary(captured.limitCommits, commitLimit, 0),
|
||||
FilterPath: captured.filterPath,
|
||||
FilterAuthor: captured.filterAuthor,
|
||||
IncludeRebaseCommits: false,
|
||||
|
||||
@@ -34,7 +34,7 @@ type ViewSubCommitsOpts struct {
|
||||
func (self *SubCommitsHelper) ViewSubCommits(opts ViewSubCommitsOpts) error {
|
||||
commits, err := self.c.Git().Loaders.CommitLoader.GetCommits(
|
||||
git_commands.GetCommitsOptions{
|
||||
Limit: true,
|
||||
Limit: commitLimit,
|
||||
FilterPath: self.c.Modes().Filtering.GetPath(),
|
||||
FilterAuthor: self.c.Modes().Filtering.GetAuthor(),
|
||||
IncludeRebaseCommits: false,
|
||||
|
||||
Reference in New Issue
Block a user