mirror of
https://github.com/ruby/ruby.git
synced 2025-08-23 21:14:23 +02:00
Skip calling f.read for overwrite: true
-only cases
We only need to set outpath for that case.
This commit is contained in:
parent
5ba9dcff16
commit
3262842e0a
1 changed files with 4 additions and 2 deletions
|
@ -30,8 +30,10 @@ class Output
|
||||||
|
|
||||||
if (@ifchange or overwrite or create_only) and (@vpath.open(@path, "rb") {|f|
|
if (@ifchange or overwrite or create_only) and (@vpath.open(@path, "rb") {|f|
|
||||||
outpath = f.path
|
outpath = f.path
|
||||||
original = f.read
|
if @ifchange or create_only
|
||||||
(@ifchange and original == data) or (create_only and !original.empty?)
|
original = f.read
|
||||||
|
(@ifchange and original == data) or (create_only and !original.empty?)
|
||||||
|
end
|
||||||
} rescue false)
|
} rescue false)
|
||||||
puts "#{outpath} #{unchanged}"
|
puts "#{outpath} #{unchanged}"
|
||||||
written = false
|
written = false
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue