Check if entry is a directory once per enumerator (#8177)
Merge pull request 8177
This commit is contained in:
parent
3c8b6c92e7
commit
709e633016
|
@ -92,6 +92,7 @@ module Jekyll
|
||||||
# Returns true if path matches against any glob pattern, else false.
|
# Returns true if path matches against any glob pattern, else false.
|
||||||
def glob_include?(enumerator, entry)
|
def glob_include?(enumerator, entry)
|
||||||
entry_with_source = PathManager.join(site.source, entry)
|
entry_with_source = PathManager.join(site.source, entry)
|
||||||
|
entry_is_directory = File.directory?(entry_with_source)
|
||||||
|
|
||||||
enumerator.any? do |pattern|
|
enumerator.any? do |pattern|
|
||||||
case pattern
|
case pattern
|
||||||
|
@ -100,7 +101,7 @@ module Jekyll
|
||||||
|
|
||||||
File.fnmatch?(pattern_with_source, entry_with_source) ||
|
File.fnmatch?(pattern_with_source, entry_with_source) ||
|
||||||
entry_with_source.start_with?(pattern_with_source) ||
|
entry_with_source.start_with?(pattern_with_source) ||
|
||||||
(pattern_with_source == "#{entry_with_source}/" if File.directory?(entry_with_source))
|
(pattern_with_source == "#{entry_with_source}/" if entry_is_directory)
|
||||||
when Regexp
|
when Regexp
|
||||||
pattern.match?(entry_with_source)
|
pattern.match?(entry_with_source)
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue