Skip to content

Commit

Permalink
Check if entry is a directory once per enumerator (#8177)
Browse files Browse the repository at this point in the history
Merge pull request 8177
  • Loading branch information
ashmaroli committed May 14, 2020
1 parent 3c8b6c9 commit 709e633
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/jekyll/entry_filter.rb
Expand Up @@ -92,6 +92,7 @@ def symlink_outside_site_source?(entry)
# 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
Expand All @@ -100,7 +101,7 @@ def glob_include?(enumerator, entry)

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
Expand Down

0 comments on commit 709e633

Please sign in to comment.