mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 09:40:21 +00:00
Allow classifier to run on symlinks as usual (#3948)
* Fixups for symlink detection, incl. test * assert the heuristics return none for symlink
This commit is contained in:
@@ -18,8 +18,6 @@ module Linguist
|
||||
#
|
||||
# Returns an Array of Language objects, most probable first.
|
||||
def self.call(blob, possible_languages)
|
||||
return [] if blob.symlink?
|
||||
|
||||
language_names = possible_languages.map(&:name)
|
||||
classify(Samples.cache, blob.data[0...CLASSIFIER_CONSIDER_BYTES], language_names).map do |name, _|
|
||||
Language[name] # Return the actual Language objects
|
||||
|
||||
@@ -27,7 +27,7 @@ module Linguist
|
||||
end
|
||||
|
||||
def symlink?
|
||||
return @symlink if !@symlink.nil?
|
||||
return @symlink if defined? @symlink
|
||||
@symlink = (File.symlink?(@fullpath) rescue false)
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user