lib/licensee/project.rb in licensee-4.3.0 vs lib/licensee/project.rb in licensee-4.3.1

- old
+ new

@@ -30,15 +30,16 @@ # Returns a Licensee::LicenseFile instance def license_file return @license_file if defined? @license_file commit = @revision ? @repository.lookup(@revision) : @repository.last_commit + tree = commit.tree.select { |blob| blob[:type] == :blob } # Prefer an exact match to one of our known file names - license_blob = commit.tree.find { |blob| LICENSE_FILENAMES.include? blob[:name].downcase } + license_blob = tree.find { |blob| LICENSE_FILENAMES.include? blob[:name].downcase } # Fall back to the first file in the project root that has the word license in it - license_blob = commit.tree.find { |blob| blob[:name] =~ /license/i } unless license_blob + license_blob = tree.find { |blob| blob[:name] =~ /license/i } unless license_blob @license_file = LicenseFile.new(@repository.lookup(license_blob[:oid])) if license_blob end # Returns the matching Licensee::License instance if a license can be detected