Skip to content

Commit

Permalink
Merge pull request #5427 from jekyll/don-t-utime-if-symlink
Browse files Browse the repository at this point in the history
Merge pull request 5427
  • Loading branch information
jekyllbot committed Sep 29, 2016
2 parents b38ac5d + 8e91263 commit f0574e0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/jekyll/static_file.rb
Expand Up @@ -146,7 +146,10 @@ def copy_file(dest_path)
else
FileUtils.copy_entry(path, dest_path)
end
File.utime(self.class.mtimes[path], self.class.mtimes[path], dest_path)

unless File.symlink?(dest_path)
File.utime(self.class.mtimes[path], self.class.mtimes[path], dest_path)
end
end
end
end
8 changes: 8 additions & 0 deletions test/test_static_file.rb
Expand Up @@ -112,6 +112,14 @@ def setup_static_file_with_defaults(base, dir, name, defaults)
assert_equal Time.new.to_i, @static_file.mtime
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
sleep 1
modify_dummy_file(@filename)
Expand Down

0 comments on commit f0574e0

Please sign in to comment.