Make sure f.read is not called twice
--revision.h and --if-change are not used simultaneously, but they might be in the future. Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
This commit is contained in:
parent
7edcdc380f
commit
5ba9dcff16
@ -28,8 +28,11 @@ class Output
|
||||
updated = color.fail("updated")
|
||||
outpath = nil
|
||||
|
||||
if (@ifchange or overwrite or create_only) and
|
||||
(@vpath.open(@path, "rb") {|f| outpath = f.path; (@ifchange and f.read == data) or (create_only and !f.read.empty?)} rescue false)
|
||||
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?)
|
||||
} rescue false)
|
||||
puts "#{outpath} #{unchanged}"
|
||||
written = false
|
||||
else
|
||||
|
Loading…
x
Reference in New Issue
Block a user