Check if entry is a directory once per enumerator (#8177)

Merge pull request 8177
This commit is contained in:
Ashwin Maroli 2020-05-14 14:28:42 +05:30 committed by GitHub
parent 3c8b6c92e7
commit 709e633016
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -92,6 +92,7 @@ module Jekyll
# Returns true if path matches against any glob pattern, else false.
def glob_include?(enumerator, entry)
entry_with_source = PathManager.join(site.source, entry)
entry_is_directory = File.directory?(entry_with_source)
enumerator.any? do |pattern|
case pattern
@ -100,7 +101,7 @@ module Jekyll
File.fnmatch?(pattern_with_source, entry_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
pattern.match?(entry_with_source)
else