diff --git a/Library/Homebrew/dev-cmd/bottle.rb b/Library/Homebrew/dev-cmd/bottle.rb index b317e19715..0b9ca5f7c8 100644 --- a/Library/Homebrew/dev-cmd/bottle.rb +++ b/Library/Homebrew/dev-cmd/bottle.rb @@ -790,10 +790,7 @@ module Homebrew def old_checksums(formula, formula_ast, bottle_hash, args:) bottle_node = formula_ast.bottle_block - if bottle_node.nil? - odie "`--keep-old` was passed but there was no existing bottle block!" if args.keep_old? - return - end + return if bottle_node.nil? return [] unless args.keep_old? old_keys = Utils::AST.body_children(bottle_node.body).map(&:method_name) diff --git a/Library/Homebrew/test/dev-cmd/bottle_spec.rb b/Library/Homebrew/test/dev-cmd/bottle_spec.rb index 40ef2ed4f7..c794479803 100644 --- a/Library/Homebrew/test/dev-cmd/bottle_spec.rb +++ b/Library/Homebrew/test/dev-cmd/bottle_spec.rb @@ -273,25 +273,6 @@ describe "brew bottle" do EOS end - it "fails to add the bottle block to a formula that has no bottle block when using --keep-old" do - core_tap.path.cd do - system "git", "init" - setup_test_formula("testball") - system "git", "add", "--all" - system "git", "commit", "-m", "testball 0.1" - end - - expect { - brew "bottle", - "--merge", - "--write", - "--keep-old", - "#{TEST_TMPDIR}/testball-1.0.arm64_big_sur.bottle.json", - "#{TEST_TMPDIR}/testball-1.0.big_sur.bottle.json", - "#{TEST_TMPDIR}/testball-1.0.catalina.bottle.json" - }.to output("Error: `--keep-old` was passed but there was no existing bottle block!\n").to_stderr - end - it "updates the bottle block in a formula that already has a bottle block (old format) when using --keep-old" do core_tap.path.cd do system "git", "init"