Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Make the file limit configurable #6550

@pkkm

Description

@pkkm

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?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions