Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions rakelib/artifacts.rake
Original file line number Diff line number Diff line change
Expand Up @@ -653,12 +653,14 @@ namespace "artifact" do

def write_to_tar(tar, path, path_in_tar)
stat = File.lstat(path)
# in the off-chance that mtime returns nil we don't want nil to be interpreted as epoch, so fall back to Time.now
mtime = (stat.mtime || Time.now).to_i
if stat.directory?
tar.mkdir(path_in_tar, :mode => stat.mode)
tar.mkdir(path_in_tar, :mode => stat.mode, :mtime => mtime)
elsif stat.symlink?
tar.symlink(path_in_tar, File.readlink(path), :mode => stat.mode)
tar.symlink(path_in_tar, File.readlink(path), :mode => stat.mode, :mtime => mtime)
else
tar.add_file_simple(path_in_tar, :mode => stat.mode, :size => stat.size) do |io|
tar.add_file_simple(path_in_tar, :mode => stat.mode, :size => stat.size, :mtime => mtime) do |io|
File.open(path, 'rb') do |fd|
chunk = nil
size = 0
Expand Down