Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pr-pull: add checksum update clause #13196

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Library/Homebrew/dev-cmd/pr-pull.rb
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@ def determine_bump_subject(old_contents, new_contents, subject_path, reason: nil
"#{subject_name} #{new_package.version}"
elsif !is_cask && old_package.revision != new_package.revision
"#{subject_name}: revision #{reason}".strip
elsif is_cask && old_package.sha256 != new_package.sha256
"#{subject_name}: checksum update #{reason}".strip
else
"#{subject_name}: #{reason || "rebuild"}".strip
end
Expand Down
17 changes: 17 additions & 0 deletions Library/Homebrew/test/dev-cmd/pr-pull_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,17 @@ class Foo < Formula
cask "food" do
desc "Helpful description"
version "1.0"
sha256 "a"
url "https://brew.sh/food-\#{version}.tgz"
end
EOS
end
let(:cask_checksum) do
<<~EOS
cask "food" do
desc "Helpful description"
version "1.0"
sha256 "b"
url "https://brew.sh/food-\#{version}.tgz"
end
EOS
Expand All @@ -53,6 +64,7 @@ class Foo < Formula
<<~EOS
cask "food" do
version "2.0"
sha256 "a"
url "https://brew.sh/food-\#{version}.tgz"
end
EOS
Expand All @@ -61,6 +73,7 @@ class Foo < Formula
<<~EOS
cask "food" do
version "1.0"
sha256 "a"
url "https://brew.sh/food-\#{version}.tgz"
end
EOS
Expand Down Expand Up @@ -164,6 +177,10 @@ class Foo < Formula
expect(described_class.determine_bump_subject(cask, cask_version, cask_file)).to eq("food 2.0")
end

it "correctly bumps a cask checksum" do
expect(described_class.determine_bump_subject(cask, cask_checksum, cask_file)).to eq("food: checksum update")
end

it "correctly bumps a formula revision with reason" do
expect(described_class.determine_bump_subject(
formula, formula_revision, formula_file, reason: "for fun"
Expand Down