summaryrefslogtreecommitdiff
path: root/tool
diff options
context:
space:
mode:
authorTakashi Kokubun <takashikkbn@gmail.com>2022-12-13 00:22:57 -0800
committerTakashi Kokubun <takashikkbn@gmail.com>2022-12-13 00:25:02 -0800
commit3262842e0adaed63935923bdc14884ac19d7549c (patch)
tree9016e07d04a1a182905ec84186afc70c3d6aeb1c /tool
parent5ba9dcff16226bbe0f24b234e62e2ed67a17ac53 (diff)
Skip calling f.read for `overwrite: true`-only cases
We only need to set outpath for that case.
Diffstat (limited to 'tool')
-rw-r--r--tool/lib/output.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/tool/lib/output.rb b/tool/lib/output.rb
index a7faa44810..51e3d32010 100644
--- a/tool/lib/output.rb
+++ b/tool/lib/output.rb
@@ -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