jesseduffield.lazygit/pkg/commands/git_commands
Stefan Kerkmann 2ed887d149 Commits: add incremental git log limit
The existing git log logic fetched the first 300 commits of a repo and
displayed them in the local and sub-commit views. Once a user selected a
commit beyond a threshold of 200 commits the whole repository was
loaded. This is problematic with large repos e.g. the linux kernel with
currently ~138k commits as lazygit slows down substantially with such a
large number of commits in memory.

This commit replaces the current all or only the first 300 commits logic
with an incremental fetching approach:

1. The first 400 commits of repo are loaded by default.
2. If the user selects a commit beyond a threshold (current limit-100)
   the git log limit is increased by 400 if there are more commits
   available. If there are more commits available is currently checked
   by comparing the previous log limit with the real commit count in the
   model, if the commit count is less then the limit it is assumed that
   we reached the end of the commit log. Ideally it would be better to
   call `git rev-list --count xyz` in the right places and compare with
   this result, but this requires more changes.

Adding a "paginated implementation" by utilizing `git log --skip=x
--max-count=y` and appending commits to the model instead of replacing
the whole collection would be nice, but this requires deeper changes to
keep everything consistent.

Signed-off-by: Stefan Kerkmann <s.kerkmann@pengutronix.de>

Co-authored-by: DeepSeek V4 Flash
2026-09-02 16:08:50 +02:00
..
bisect.go Don't log the "git rev-list" call when marking bisect commits 2026-01-25 11:47:07 +01:00
bisect_info.go rename sha to hash 2 2024-04-12 08:33:47 +02:00
blame.go Suppress command logs for git calls related to the ctrl+f command 2026-07-19 19:22:48 +02:00
branch.go Add backward cycling support for all branches log view 2026-03-08 17:06:17 +01:00
branch_loader.go perf(branches): use for-each-ref ahead-behind for git >= 2.41 2026-04-27 07:09:23 +02:00
branch_loader_test.go perf(branches): use for-each-ref ahead-behind for git >= 2.41 2026-04-27 07:09:23 +02:00
branch_test.go Replace MergeOpts struct with MergeVariant enum 2025-10-19 21:24:28 +02:00
commit.go Rework the custom pager config (rename to diff renderer) 2026-07-31 08:42:51 +02:00
commit_file_loader.go Show renamed files in the custom patch builder 2026-07-04 13:05:09 +02:00
commit_file_loader_test.go Show renamed files in the custom patch builder 2026-07-04 13:05:09 +02:00
commit_loader.go Commits: add incremental git log limit 2026-09-02 16:08:50 +02:00
commit_loader_test.go Avoid rehydrating unchanged rebase todos 2026-08-29 17:25:59 +02:00
commit_loading_shared.go Fix showing diffs for renamed file when filtering by path 2025-07-27 12:05:41 +02:00
commit_test.go Rework the custom pager config (rename to diff renderer) 2026-07-31 08:42:51 +02:00
common.go Rework the custom pager config (rename to diff renderer) 2026-07-31 08:42:51 +02:00
config.go Add support for git flow using git-flow-next 2026-05-26 11:57:09 +02:00
config_test.go Add support for git flow using git-flow-next 2026-05-26 11:57:09 +02:00
custom.go Add runCommand function to Go template syntax 2025-04-09 10:44:36 +02:00
deps_test.go Rework the custom pager config (rename to diff renderer) 2026-07-31 08:42:51 +02:00
diff.go Rework the custom pager config (rename to diff renderer) 2026-07-31 08:42:51 +02:00
file.go Support absolute paths when detecting edit preset from EDITOR env var 2026-07-30 17:31:56 +02:00
file_loader.go Recognize worktrees among the files from the worktrees model 2026-08-15 11:26:58 +02:00
file_loader_test.go Honor the conflict-marker-size gitattribute 2026-08-08 12:43:42 +02:00
file_test.go Support absolute paths when detecting edit preset from EDITOR env var 2026-07-30 17:31:56 +02:00
flow.go Add support for git flow using git-flow-next 2026-05-26 11:57:09 +02:00
flow_test.go Add support for git flow using git-flow-next 2026-05-26 11:57:09 +02:00
git_command_builder.go Don't let our repo answer for a different one 2026-08-08 11:15:01 +02:00
git_command_builder_test.go Add runGitCmdOnPaths utility 2026-03-27 14:34:47 +01:00
github.go Get the GitHub token from gh instead of resolving it in-process 2026-08-12 19:13:06 +02:00
github_test.go Carry aggregate check state with GitHub pull requests 2026-07-31 09:01:44 +02:00
hosting_service.go Remove now unused code 2026-05-10 15:28:14 +02:00
main_branches.go Cleanup: remove the ignoringWarnings hack from GetMergeBase 2025-07-31 15:21:34 +02:00
patch.go Fix patch commands when git config has color=always 2026-03-30 10:42:26 +02:00
rebase.go Move dragged commits in one rebase 2026-07-31 08:37:28 +02:00
rebase_test.go Fix dropping submodule changes from a commit 2025-10-10 12:55:58 +02:00
reflog_commit_loader.go Fix showing diffs for renamed file when filtering by path 2025-07-27 12:05:41 +02:00
reflog_commit_loader_test.go Fix showing diffs for renamed file when filtering by path 2025-07-27 12:05:41 +02:00
remote.go Copy gocui files into lazygit repo under pkg/gocui 2026-04-30 14:29:08 +02:00
remote_loader.go Add PushUrls field to models.Remote 2026-05-04 13:09:47 +02:00
remote_loader_test.go Add PushUrls field to models.Remote 2026-05-04 13:09:47 +02:00
repo_paths.go Recognize worktrees among the files from the worktrees model 2026-08-15 11:26:58 +02:00
repo_paths_test.go Open the repo when lazygit is started in its .git dir 2026-08-08 11:15:01 +02:00
stash.go Rework the custom pager config (rename to diff renderer) 2026-07-31 08:42:51 +02:00
stash_loader.go Add hash field to models.StashEntry 2025-08-25 19:23:30 +02:00
stash_loader_test.go Add hash field to models.StashEntry 2025-08-25 19:23:30 +02:00
stash_test.go Rework the custom pager config (rename to diff renderer) 2026-07-31 08:42:51 +02:00
status.go Add Status.RefsSnapshot 2026-06-19 18:07:48 +02:00
status_test.go Add Status.RefsSnapshot 2026-06-19 18:07:48 +02:00
submodule.go Don't let our repo answer for a different one 2026-08-08 11:15:01 +02:00
submodule_test.go Don't let our repo answer for a different one 2026-08-08 11:15:01 +02:00
sync.go Copy gocui files into lazygit repo under pkg/gocui 2026-04-30 14:29:08 +02:00
sync_test.go Copy gocui files into lazygit repo under pkg/gocui 2026-04-30 14:29:08 +02:00
tag.go Suppress command logs for tag commands 2026-07-19 19:19:47 +02:00
tag_loader.go Revert "Add IsAnnotated field to models.Tag struct" 2025-07-28 10:53:51 +02:00
tag_loader_test.go Revert "Add IsAnnotated field to models.Tag struct" 2025-07-28 10:53:51 +02:00
version.go Add a method GitVersion.IsAtLeast 2024-01-10 09:18:38 +01:00
version_test.go Add a method GitVersion.IsAtLeast 2024-01-10 09:18:38 +01:00
working_tree.go Extract a single helper for the paths a node's diff is limited to 2026-08-17 09:32:30 +02:00
working_tree_test.go Extract GitCommandBuilder method AddCommonDiffArgs 2026-07-31 08:42:51 +02:00
worktree.go Don't let our repo answer for a different one 2026-08-08 11:15:01 +02:00
worktree_loader.go Don't let our repo answer for a different one 2026-08-08 11:15:01 +02:00
worktree_loader_test.go Identify the current and main worktree by git dir, not by path 2026-08-08 11:15:01 +02:00