mojombo/jekyll — Issue #510: Jekyll deletes files that are not outdated
Author: grahamdennis
Created: 2012-02-16 06:00:38+00:00
State: open

When deciding whether a file or directory is outdated, Jekyll can delete files that it shouldn't.

This can occur, because Jekyll only exempts the immediate parent directory of every file from being deleted. However parents of those directories can be deleted, thus removing the subdirectories.

The following code in site.cleanup fixes the issue:

# adding files' parent directories recursively
dirs = Set.new
files.each do |file|
part = file
while part != '/' do
part = File.dirname(part)
dirs << part
end
end
files.merge(dirs)