From 33cf882e348ae854f127ce7c1feec4235f552adc Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Thu, 31 May 2018 19:53:12 +0100 Subject: [PATCH] bump-formula-pr: improve bad argument handling. --- Library/Homebrew/dev-cmd/bump-formula-pr.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Library/Homebrew/dev-cmd/bump-formula-pr.rb b/Library/Homebrew/dev-cmd/bump-formula-pr.rb index aaaa158ab3..0867948815 100644 --- a/Library/Homebrew/dev-cmd/bump-formula-pr.rb +++ b/Library/Homebrew/dev-cmd/bump-formula-pr.rb @@ -339,6 +339,9 @@ module Homebrew unless Homebrew.args.quiet? ohai "replace #{old.inspect} with #{new.inspect}" end + unless old + raise "No old value for new value #{new}! Did you pass the wrong arguments?" + end contents.gsub!(old, new) end unless contents.errors.empty? @@ -352,6 +355,9 @@ module Homebrew unless Homebrew.args.quiet? ohai "replace #{old.inspect} with #{new.inspect}" end + unless old + raise "No old value for new value #{new}! Did you pass the wrong arguments?" + end s.gsub!(old, new) end end