From 986611ac36dcea2aacf0d165620b0f32167e209f Mon Sep 17 00:00:00 2001 From: Arfon Smith Date: Fri, 4 Jul 2014 21:12:46 -0500 Subject: [PATCH 1/2] Ask Charlock earlier --- lib/linguist/language.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/linguist/language.rb b/lib/linguist/language.rb index 81e70361..87f84f7b 100644 --- a/lib/linguist/language.rb +++ b/lib/linguist/language.rb @@ -104,7 +104,7 @@ module Linguist # # We'll perform a more comprehensive test later which actually involves # looking for binary characters in the blob - return nil if blob.likely_binary? + return nil if blob.likely_binary? || blob.binary? # A bit of an elegant hack. If the file is executable but extensionless, # append a "magic" extension so it can be classified with other From bc7596a8b5232ba9b5122c7969ac453b954ea268 Mon Sep 17 00:00:00 2001 From: Arfon Smith Date: Mon, 7 Jul 2014 15:24:22 -0500 Subject: [PATCH 2/2] Removing second binary? check --- lib/linguist/language.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/linguist/language.rb b/lib/linguist/language.rb index 87f84f7b..f1836721 100644 --- a/lib/linguist/language.rb +++ b/lib/linguist/language.rb @@ -124,7 +124,7 @@ module Linguist possible_language_names = possible_languages.map(&:name) # Don't bother with binary contents or an empty file - if blob.binary? || data.nil? || data == "" + if data.nil? || data == "" nil # Check if there's a shebang line and use that as authoritative elsif (result = find_by_shebang(data)) && !result.empty? @@ -401,7 +401,7 @@ module Linguist # # Returns the extensions Array attr_reader :filenames - + # Public: Return all possible extensions for language def all_extensions (extensions + [primary_extension]).uniq