Skip to content

Conversation

@stefanhaller
Copy link
Collaborator

The file suggestions list that appears when you choose "Enter path to filter by" from the Filtering menu was previously implemented by walking the file system to collect all files, and then filter out the ones that are git-ignored. This approach had several problems:

  • for certain .gitignore configurations there was a bug in the code that filters out ignored files, causing the list to be empty. See File suggestion not working #2642 (comment) for details.
  • the list included files from submodules. While at first glance this might sound useful, it doesn't work: choosing a file from the list shows an empty log. Lazygit would have to switch to the submodule first to show the log, which would be unexpected in the context of the Filtering dialog, so it's better to not show these files, and require the user to enter a submodule explicitly before they can filter on a file in it.
  • it was rather slow.

This PR improves all these by using a call to git ls-files to list the repositories files.

Here are some rough hand-timed measurements (from opening the Filtering dialog until the file list shows) for various repos:

before after
lazygit (3'200 files) ~1s not measurable
my work repo (90'000 files) 7s <1s
llvm (150'000 files) 5s ~1s

Fixes #2642

@stefanhaller stefanhaller added bug Something isn't working performance labels Nov 20, 2025
@codacy-production
Copy link

codacy-production bot commented Nov 20, 2025

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
Report missing for 9d249631 91.67%
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (9d24963) Report Missing Report Missing Report Missing
Head commit (b06c2bb) 59132 51420 86.96%

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#5056) 24 22 91.67%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

See your quality gate settings    Change summary preferences

Footnotes

  1. Codacy didn't receive coverage data for the commit, or there was an error processing the received data. Check your integration for errors and validate that your coverage setup is correct.

@stefanhaller stefanhaller marked this pull request as ready for review November 20, 2025 19:25
@stefanhaller stefanhaller removed the bug Something isn't working label Nov 20, 2025
@stefanhaller stefanhaller force-pushed the fix-and-speed-up-file-suggestions branch from 28be8d5 to b06c2bb Compare November 21, 2025 06:58
@stefanhaller stefanhaller merged commit b57be9e into master Nov 21, 2025
13 checks passed
@stefanhaller stefanhaller deleted the fix-and-speed-up-file-suggestions branch November 21, 2025 06:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

2 participants