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

Rely on the Linguist::Repository::MAX_TREE_SIZE default value more #6830

Merged
merged 2 commits into from
May 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions bin/git-linguist
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ require 'tempfile'
require 'zlib'

class GitLinguist
def initialize(path, commit_oid, incremental = true, tree_size = 100_000)
def initialize(path, commit_oid, incremental = true, tree_size = Linguist::Repository.MAX_TREE_SIZE)
@repo_path = path
@commit_oid = commit_oid
@incremental = incremental
Expand Down Expand Up @@ -99,7 +99,7 @@ end
def git_linguist(args)
incremental = true
commit = nil
tree_size = 100_000
tree_size = Linguist::Repository::MAX_TREE_SIZE

parser = OptionParser.new do |opts|
opts.banner = <<~HELP
Expand All @@ -112,7 +112,8 @@ def git_linguist(args)

opts.on("-f", "--force", "Force a full rescan") { incremental = false }
opts.on("-c", "--commit=COMMIT", "Commit to index") { |v| commit = v}
opts.on("-t", "--tree-size=NUMBER", Integer, "Maximum number of files scanned to detect languages (default: 100,000)" ) { |t| tree_size = t }
opts.on("-t", "--tree-size=NUMBER", Integer,
"Maximum number of files scanned to detect languages (default: #{Linguist::Repository::MAX_TREE_SIZE})" ) { |t| tree_size = t }
end

parser.parse!(args)
Expand Down
5 changes: 3 additions & 2 deletions bin/github-linguist
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ HELP
def github_linguist(args)
breakdown = false
json_output = false
tree_size = 100_000
tree_size = Linguist::Repository::MAX_TREE_SIZE
rev = 'HEAD'
path = Dir.pwd

Expand All @@ -33,7 +33,8 @@ def github_linguist(args)
opts.on("-r", "--rev REV", String,
"Analyze specific git revision",
"defaults to HEAD, see gitrevisions(1) for alternatives") { |r| rev = r }
opts.on("-t", "--tree-size=NUMBER", Integer, "Maximum number of files scanned to detect languages (default: 100,000)") { |t| tree_size = t }
opts.on("-t", "--tree-size=NUMBER", Integer,
"Maximum number of files scanned to detect languages (default: #{Linguist::Repository::MAX_TREE_SIZE})") { |t| tree_size = t }
opts.on("-h", "--help", "Display a short usage summary, then exit") do
puts opts
exit
Expand Down
Loading