Merge pull request #5427 from jekyll/don-t-utime-if-symlink

Merge pull request 5427
This commit is contained in:
jekyllbot 2016-09-29 13:26:24 -07:00 committed by GitHub
commit f0574e047e
2 changed files with 12 additions and 1 deletions

View File

@ -146,7 +146,10 @@ module Jekyll
else else
FileUtils.copy_entry(path, dest_path) FileUtils.copy_entry(path, dest_path)
end end
unless File.symlink?(dest_path)
File.utime(self.class.mtimes[path], self.class.mtimes[path], dest_path) File.utime(self.class.mtimes[path], self.class.mtimes[path], dest_path)
end end
end end
end
end end

View File

@ -112,6 +112,14 @@ class TestStaticFile < JekyllUnitTest
assert_equal Time.new.to_i, @static_file.mtime assert_equal Time.new.to_i, @static_file.mtime
end end
should "only set modified time if not a symlink" do
expect(File).to receive(:symlink?).and_return(true)
expect(File).not_to receive(:utime)
@static_file.write(dest_dir)
allow(File).to receive(:symlink?).and_call_original
end
should "known if the source path is modified, when it is" do should "known if the source path is modified, when it is" do
sleep 1 sleep 1
modify_dummy_file(@filename) modify_dummy_file(@filename)