Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Add source and destination directory protection #535
After accidentally telling jekyll to use my source directory as it's destination directory, and losing work because it also deleted my
First was to remove the dot-file deletion entirely from the cleanup of the site. This is a potentially very dangerous action that's impossible to test that it's correct. If the '..' check line ever disappears, even running the tests will attempt to delete everything accessible on the person's computer.
From what I can tell, all generated dot-files will already be known by Jekyll, and any static files will be configured for Jekyll to include, so it should properly remove all the files that it already knows about.
With this changed, I've also added a check on site generation that the destination directory doesn't include, or isn't exactly the same as, the source directory. While this isn't 100% fool proof, you'd need to use some symlinking to still cause an unfortunate destruction of your source files, this should cover almost all cases people would normally run into.
This is the results of discussion in #534 among others.
It has always bothered me that Jekyll mangles timestamps. When you run jekyll to regenerate your site, all timestamps are updated to the current time. (This is because all pages are regenerated—a separate and also annoying issue.) So to anything that uses timestamps to determine when a page has changed, it appears that every page changes whenever a single page changes.
The solution would be Jekyll, generate only the files that have changed and not all
@web2developer It's a nice idea, but not really something that is practical. We could keep a cache and check the contents with a hash or something for changes, but we have to regenerate the entire site again (except static files) if any change has been made to any pieces of the site. That's because Jekyll has no idea how your site is interconnected. Jekyll must regenerate all files when anything has changed - there's no real way around it.