Skip to content
Open
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
11 changes: 5 additions & 6 deletions lib/net/scp/download.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,11 @@ def read_directive_state(channel)
when :file
read_file(channel, directive)
when :end
directory = channel[:stack].pop
if channel[:options][:preserve] && directory && directory[:times]
File.utime(directory[:times][:atime], directory[:times][:mtime], channel[:local])
end
channel[:local] = File.dirname(channel[:local])
channel[:stack].pop
channel[:state] = :finish if channel[:stack].empty?
end

Expand Down Expand Up @@ -134,11 +137,7 @@ def read_directory(channel, directive)
Dir.mkdir(channel[:local], directive[:mode] | 0700)
end

if channel[:options][:preserve] && channel[:times]
File.utime(channel[:times][:atime], channel[:times][:mtime], channel[:local])
end

channel[:stack] << directive
channel[:stack] << directive.merge(:times => channel[:times])
channel[:times] = nil
end

Expand Down