Skip to content

Commit

Permalink
Fix false positive conflicts for static files in a collection (jekyll…
Browse files Browse the repository at this point in the history
…#9141)

Merge pull request 9141
  • Loading branch information
yboulkaid authored and Olly Headey committed Oct 27, 2022
1 parent 9e4c727 commit 3c85f22
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/jekyll/site.rb
Original file line number Diff line number Diff line change
Expand Up @@ -360,9 +360,13 @@ def documents
end

def each_site_file
seen_files = []
%w(pages static_files_to_write docs_to_write).each do |type|
send(type).each do |item|
next if seen_files.include?(item)

yield item
seen_files << item
end
end
end
Expand Down
9 changes: 9 additions & 0 deletions test/test_site.rb
Original file line number Diff line number Diff line change
Expand Up @@ -749,5 +749,14 @@ def convert(*_args)

assert_includes site.static_files.map(&:relative_path), "_methods/extensionless_static_file"
end

should "not be revisited in `Site#each_site_file`" do
site = fixture_site("collections" => { "methods" => { "output" => true } })
site.read

visited_files = []
site.each_site_file { |file| visited_files << file }
assert_equal visited_files.count, visited_files.uniq.count
end
end
end

0 comments on commit 3c85f22

Please sign in to comment.