Skip to content

Commit

Permalink
Rely on the Linguist::Repository::MAX_TREE_SIZE default value more
Browse files Browse the repository at this point in the history
- Changing it won't be such a problem in future if there's just one place to change it. I hadn't realised it had propagated so much!
  • Loading branch information
issyl0 committed May 15, 2024
1 parent d9b3140 commit 78ba721
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 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 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

0 comments on commit 78ba721

Please sign in to comment.