Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make the file limit configurable #6550

Closed
pkkm opened this issue Sep 18, 2023 · 1 comment
Closed

Make the file limit configurable #6550

pkkm opened this issue Sep 18, 2023 · 1 comment

Comments

@pkkm
Copy link

pkkm commented Sep 18, 2023

Currently, Linguist has a 100,000 file limit hardcoded in lib/linguist/repository.rb:

    protected
    MAX_TREE_SIZE = 100_000

When the number of files in the repository exceeds that, Linguist gives up and returns an empty result:

    def compute_stats(old_commit_oid, cache = nil)
      return {} if current_tree.count_recursive(MAX_TREE_SIZE) >= MAX_TREE_SIZE

This may be a good limit for GitHub, but I think that the library would be more widely useful if it was possible to change it—for example, via a getter/setter pair that accepted either a number or nil (to disable the check entirely).

A related issue is that when the limit is exceeded, Linguist returns an empty hash, which is the same as for an empty repository, with no indication of what happened. This can be quite confusing—or at least, it confused me the first time it happened, and issues #2915 and #3342 indicate that it has confused other people as well. Perhaps it could be changed to something that communicates the issue clearly, such as return :too_many_files or raise FileLimitExceededError?

@lildude
Copy link
Member

lildude commented Aug 13, 2024

Resolved by #6806 and #6825

@lildude lildude closed this as completed Aug 13, 2024
@github-linguist github-linguist locked as resolved and limited conversation to collaborators Nov 15, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants
@lildude @pkkm and others