diff --git a/Library/Homebrew/dev-cmd/bump-cask-pr.rb b/Library/Homebrew/dev-cmd/bump-cask-pr.rb index 91cd4da0c4852..cc0f8c0d120ac 100644 --- a/Library/Homebrew/dev-cmd/bump-cask-pr.rb +++ b/Library/Homebrew/dev-cmd/bump-cask-pr.rb @@ -116,22 +116,6 @@ def bump_cask_pr branch_name = "bump-#{cask.token}" commit_message = nil - if new_version.present? - # For simplicity, our naming defers to the arm version if we multiple architectures are specified - branch_version = new_version.arm || new_version.general - if branch_version.is_a?(Cask::DSL::Version) - commit_version = if branch_version.before_comma == cask.version.before_comma - branch_version - else - branch_version.before_comma - end - branch_name = "bump-#{cask.token}-#{branch_version.tr(",:", "-")}" - commit_message ||= "#{cask.token} #{commit_version}" - end - replacement_pairs = replace_version_and_checksum(cask, new_hash, new_version, replacement_pairs) - end - # Now that we have all replacement pairs, we will replace them further down - old_contents = File.read(cask.sourcefile_path) if new_base_url @@ -148,6 +132,22 @@ def bump_cask_pr ] end + if new_version.present? + # For simplicity, our naming defers to the arm version if we multiple architectures are specified + branch_version = new_version.arm || new_version.general + if branch_version.is_a?(Cask::DSL::Version) + commit_version = if branch_version.before_comma == cask.version.before_comma + branch_version + else + branch_version.before_comma + end + branch_name = "bump-#{cask.token}-#{branch_version.tr(",:", "-")}" + commit_message ||= "#{cask.token} #{commit_version}" + end + replacement_pairs = replace_version_and_checksum(cask, new_hash, new_version, replacement_pairs) + end + # Now that we have all replacement pairs, we will replace them further down + commit_message ||= "#{cask.token}: update checksum" if new_hash # Remove nested arrays where elements are identical