Skip calling f.read for overwrite: true-only cases

We only need to set outpath for that case.
This commit is contained in:
Takashi Kokubun 2022-12-13 00:22:57 -08:00
parent 5ba9dcff16
commit 3262842e0a
No known key found for this signature in database
GPG Key ID: 6FFC433B12EE23DD

View File

@ -30,8 +30,10 @@ class Output
if (@ifchange or overwrite or create_only) and (@vpath.open(@path, "rb") {|f|
outpath = f.path
original = f.read
(@ifchange and original == data) or (create_only and !original.empty?)
if @ifchange or create_only
original = f.read
(@ifchange and original == data) or (create_only and !original.empty?)
end
} rescue false)
puts "#{outpath} #{unchanged}"
written = false