mirror of
				https://github.com/KevinMidboe/linguist.git
				synced 2025-10-29 17:50:22 +00:00 
			
		
		
		
	Fix the linguist binary
This commit is contained in:
		| @@ -5,6 +5,7 @@ | |||||||
|  |  | ||||||
| require 'linguist/file_blob' | require 'linguist/file_blob' | ||||||
| require 'linguist/repository' | require 'linguist/repository' | ||||||
|  | require 'rugged' | ||||||
|  |  | ||||||
| path = ARGV[0] || Dir.pwd | path = ARGV[0] || Dir.pwd | ||||||
|  |  | ||||||
| @@ -18,7 +19,8 @@ ARGV.shift | |||||||
| breakdown = true if ARGV[0] == "--breakdown" | breakdown = true if ARGV[0] == "--breakdown" | ||||||
|  |  | ||||||
| if File.directory?(path) | if File.directory?(path) | ||||||
|   repo = Linguist::Repository.from_directory(path) |   rugged = Rugged::Repository.new(path) | ||||||
|  |   repo = Linguist::Repository.new(rugged, rugged.head.target_id) | ||||||
|   repo.languages.sort_by { |_, size| size }.reverse.each do |language, size| |   repo.languages.sort_by { |_, size| size }.reverse.each do |language, size| | ||||||
|     percentage = ((size / repo.size.to_f) * 100) |     percentage = ((size / repo.size.to_f) * 100) | ||||||
|     percentage = sprintf '%.2f' % percentage |     percentage = sprintf '%.2f' % percentage | ||||||
|   | |||||||
| @@ -29,6 +29,8 @@ module Linguist | |||||||
|     def initialize(repo, commit_oid) |     def initialize(repo, commit_oid) | ||||||
|       @repository = repo |       @repository = repo | ||||||
|       @commit_oid = commit_oid |       @commit_oid = commit_oid | ||||||
|  |  | ||||||
|  |       raise TypeError, 'commit_oid must be a commit SHA1' unless commit_oid.is_a?(String) | ||||||
|     end |     end | ||||||
|  |  | ||||||
|     # Public: Load the results of a previous analysis on this repository |     # Public: Load the results of a previous analysis on this repository | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user