mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 17:50:22 +00:00
Merge pull request #1354 from github/binary-language-mkII
Ask Charlock earlier
This commit is contained in:
@@ -104,7 +104,7 @@ module Linguist
|
|||||||
#
|
#
|
||||||
# We'll perform a more comprehensive test later which actually involves
|
# We'll perform a more comprehensive test later which actually involves
|
||||||
# looking for binary characters in the blob
|
# 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,
|
# A bit of an elegant hack. If the file is executable but extensionless,
|
||||||
# append a "magic" extension so it can be classified with other
|
# append a "magic" extension so it can be classified with other
|
||||||
@@ -124,7 +124,7 @@ module Linguist
|
|||||||
possible_language_names = possible_languages.map(&:name)
|
possible_language_names = possible_languages.map(&:name)
|
||||||
|
|
||||||
# Don't bother with binary contents or an empty file
|
# Don't bother with binary contents or an empty file
|
||||||
if blob.binary? || data.nil? || data == ""
|
if data.nil? || data == ""
|
||||||
nil
|
nil
|
||||||
# Check if there's a shebang line and use that as authoritative
|
# Check if there's a shebang line and use that as authoritative
|
||||||
elsif (result = find_by_shebang(data)) && !result.empty?
|
elsif (result = find_by_shebang(data)) && !result.empty?
|
||||||
|
|||||||
Reference in New Issue
Block a user