jesseduffield.lazygit/pkg/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
..
direnv Offer direnv .envrc approval from inside lazygit 2026-06-04 09:05:01 +02:00
git_commands Commits: add incremental git log limit 2026-09-02 16:08:50 +02:00
git_config Pin the cached git config's commands to the repo directory 2026-07-20 17:07:39 +02:00
hosting_service Optimize regex compilations 2026-05-10 15:28:14 +02:00
models Make the conflict marker size a parameter of our marker matching 2026-08-08 12:43:42 +02:00
oscommands Drop FlushStaleCells, which no longer has anything to flush 2026-08-15 15:30:27 +02:00
patch Preallocate arrays where the new linter version would warn about it 2026-08-16 16:35:11 +02:00
testdata Support opening lazygit in a submodule 2019-05-12 17:59:49 +10:00
git.go Tell git where the repo is when it can't find it itself 2026-08-08 11:15:01 +02:00
git_cmd_obj_builder.go Tell git where the repo is when it can't find it itself 2026-08-08 11:15:01 +02:00
git_cmd_obj_builder_test.go Tell git where the repo is when it can't find it itself 2026-08-08 11:15:01 +02:00
git_cmd_obj_runner.go Back off exponentially between lock-error retries 2026-07-15 10:08:44 +02:00
git_cmd_obj_runner_test.go Back off exponentially between lock-error retries 2026-07-15 10:08:44 +02:00